Package com.midtrans.service.impl
Class MidtransSnapApiImpl
- java.lang.Object
-
- com.midtrans.service.impl.MidtransSnapApiImpl
-
- All Implemented Interfaces:
MidtransSnapApi
public class MidtransSnapApiImpl extends Object implements MidtransSnapApi
Implements fromMidtransSnapApi
-
-
Constructor Summary
Constructors Constructor Description MidtransSnapApiImpl(Config config)SnapAPI constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigapiConfig()Do re-set config Class like clientKey, serverKey, isProductionorg.json.JSONObjectcreateTransaction(Map<String,Object> params)Do `/transactions` API request to SNAP API return RAW JSON with JSONObjectStringcreateTransactionRedirectUrl(Map<String,Object> params)Do `/transactions` API request to SNAP API return String redirectURLStringcreateTransactionToken(Map<String,Object> params)Do `/transactions` API request to SNAP API return String token
-
-
-
Constructor Detail
-
MidtransSnapApiImpl
public MidtransSnapApiImpl(Config config)
SnapAPI constructor- Parameters:
config- Midtransconfiguration
-
-
Method Detail
-
apiConfig
public Config apiConfig()
Description copied from interface:MidtransSnapApiDo re-set config Class like clientKey, serverKey, isProduction- Specified by:
apiConfigin interfaceMidtransSnapApi- Returns:
- Config.class
-
createTransaction
public org.json.JSONObject createTransaction(Map<String,Object> params) throws MidtransError
Description copied from interface:MidtransSnapApiDo `/transactions` API request to SNAP API return RAW JSON with JSONObject- Specified by:
createTransactionin interfaceMidtransSnapApi- Parameters:
params- {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more detail refer to: https://snap-docs.midtrans.com)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
createTransactionToken
public String createTransactionToken(Map<String,Object> params) throws MidtransError
Description copied from interface:MidtransSnapApiDo `/transactions` API request to SNAP API return String token- Specified by:
createTransactionTokenin interfaceMidtransSnapApi- Parameters:
params- {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more detail refer to: https://snap-docs.midtrans.com)- Returns:
- {String} return tokenId to processing on frontend with Snap.js for transaction with SNAP PopUp
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
createTransactionRedirectUrl
public String createTransactionRedirectUrl(Map<String,Object> params) throws MidtransError
Description copied from interface:MidtransSnapApiDo `/transactions` API request to SNAP API return String redirectURL- Specified by:
createTransactionRedirectUrlin interfaceMidtransSnapApi- Parameters:
params- {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more detail refer to: https://snap-docs.midtrans.com)- Returns:
- {String} - return redirectURL for processing transaction with SNAP Redirect
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
-