Package com.midtrans.service.impl
Class MidtransCoreApiImpl
- java.lang.Object
-
- com.midtrans.service.impl.MidtransCoreApiImpl
-
- All Implemented Interfaces:
MidtransCoreApi
public class MidtransCoreApiImpl extends Object implements MidtransCoreApi
Implements fromMidtransCoreApi
-
-
Constructor Summary
Constructors Constructor Description MidtransCoreApiImpl(Config config)CoreAPI 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.JSONObjectapproveTransaction(String param)Do `/{orderId}/approve` API request to Core APIorg.json.JSONObjectcancelTransaction(String param)Do `/{orderId}/cancel` API request to Core APIorg.json.JSONObjectcaptureTransaction(Map<String,String> params)Do `/capture API` request to Core APIorg.json.JSONObjectcardPointInquiry(String tokenId)Do `/point_inquiry/{tokenId}` API request to Core APIorg.json.JSONObjectcardToken(Map<String,String> params)Do `/token` API request to Core APIorg.json.JSONObjectchargeTransaction(Map<String,Object> body)Do /charge API request to Core APIorg.json.JSONObjectcheckTransaction(String param)Do /{orderId}/status API request to Core APIorg.json.JSONObjectcreateSubscription(Map<String,Object> subscriptionReq)Do `v1/subscriptions` API request to Core API for Create subscription.org.json.JSONObjectdenyTransaction(String param)Do `/{orderId}/deny` API request to Core APIorg.json.JSONObjectdirectRefundTransaction(String param, Map<String,String> requestBody)Do `/{orderId}/status/b2b` API request to Core APIorg.json.JSONObjectdisableSubscription(String subscriptionId)Do `v1/subscriptions/{subscription_id}/disable` Make the subscription inactive (the subscription will not create transaction anymore)s.org.json.JSONObjectenableSubscription(String subscriptionId)Do `v1/subscriptions/{subscription_id}/enable` Make the subscription active (the subscription will create periodic transaction) (more detail refer to: http://api-docs.midtrans.com/#enable-subscription)org.json.JSONObjectexpireTransaction(String param)Do `/{orderId}/expire` API request to Core APIorg.json.JSONObjectgetBIN(String binNumber)Do `v1/bins/{bin}` API request to Core APIorg.json.JSONObjectgetPaymentAccount(String accountId)Do `v2/pay/account/{account_id}` find account by id to see the customer account details (more detail refer to: http://api-docs.midtrans.com/#get-pay-account)org.json.JSONObjectgetSubscription(String subscriptionId)Do `v1/subscriptions/{subscription_id}` Find subscription by id to see the subscription details.org.json.JSONObjectgetTransactionStatusB2B(String param)Do `/point_inquiry/{tokenId}` API request to Core APIorg.json.JSONObjectlinkPaymentAccount(Map<String,Object> accountRequest)Do `/v2/pay/account` to link customer account to be used for specific payment channels (more detail refer to: http://api-docs.midtrans.com/#create-pay-account)org.json.JSONObjectrefundTransaction(String param, Map<String,String> body)Do `/{orderId}/refund` API request to Core APIorg.json.JSONObjectregisterCard(Map<String,String> params)Do `/card/register` API request to Core APIorg.json.JSONObjectunlinkPaymentAccount(String accountId)Do `v2/pay/account/{account_id}/unbind` to unbind a linked customer account (more detail refer to: http://api-docs.midtrans.com/#unbind-pay-account)org.json.JSONObjectupdateSubscription(String subscriptionId, Map<String,Object> subscriptionReq)Do `v1/subscriptions/{subscription_id}` Update existing subscription details.
-
-
-
Constructor Detail
-
MidtransCoreApiImpl
public MidtransCoreApiImpl(Config config)
CoreAPI constructor- Parameters:
config- Midtransconfiguration
-
-
Method Detail
-
apiConfig
public Config apiConfig()
Description copied from interface:MidtransCoreApiDo re-set config Class like clientKey, serverKey, isProduction- Specified by:
apiConfigin interfaceMidtransCoreApi- Returns:
- Config.class
-
chargeTransaction
public org.json.JSONObject chargeTransaction(Map<String,Object> body) throws MidtransError
Description copied from interface:MidtransCoreApiDo /charge API request to Core API- Specified by:
chargeTransactionin interfaceMidtransCoreApi- Parameters:
body- Map Object parameter, object of Core API JSON body as parameter, will be converted to JSON (more params detail refer to: https://api-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.
-
checkTransaction
public org.json.JSONObject checkTransaction(String param) throws MidtransError
Description copied from interface:MidtransCoreApiDo /{orderId}/status API request to Core API- Specified by:
checkTransactionin interfaceMidtransCoreApi- Parameters:
param- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#get-transaction-status)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
approveTransaction
public org.json.JSONObject approveTransaction(String param) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/{orderId}/approve` API request to Core API- Specified by:
approveTransactionin interfaceMidtransCoreApi- Parameters:
param- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#approve-transaction)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
cancelTransaction
public org.json.JSONObject cancelTransaction(String param) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/{orderId}/cancel` API request to Core API- Specified by:
cancelTransactionin interfaceMidtransCoreApi- Parameters:
param- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#cancel-transaction)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
expireTransaction
public org.json.JSONObject expireTransaction(String param) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/{orderId}/expire` API request to Core API- Specified by:
expireTransactionin interfaceMidtransCoreApi- Parameters:
param- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#expire-transaction)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
refundTransaction
public org.json.JSONObject refundTransaction(String param, Map<String,String> body) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/{orderId}/refund` API request to Core API- Specified by:
refundTransactionin interfaceMidtransCoreApi- Parameters:
param- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#refund-transaction)body- {Map Object} object of Core API JSON body as parameter, will be converted to JSON- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
cardToken
public org.json.JSONObject cardToken(Map<String,String> params) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/token` API request to Core API- Specified by:
cardTokenin interfaceMidtransCoreApi- Parameters:
params- {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more params detail refer to: https://api-docs.midtrans.com/#get-token)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
registerCard
public org.json.JSONObject registerCard(Map<String,String> params) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/card/register` API request to Core API- Specified by:
registerCardin interfaceMidtransCoreApi- Parameters:
params- {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more params detail refer to: https://api-docs.midtrans.com/#register-card)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
cardPointInquiry
public org.json.JSONObject cardPointInquiry(String tokenId) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/point_inquiry/{tokenId}` API request to Core API- Specified by:
cardPointInquiryin interfaceMidtransCoreApi- Parameters:
tokenId- {String} of credit card (more detail refer to: https://api-docs.midtrans.com/#point-inquiry)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
captureTransaction
public org.json.JSONObject captureTransaction(Map<String,String> params) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/capture API` request to Core API- Specified by:
captureTransactionin interfaceMidtransCoreApi- Parameters:
params- {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more params detail refer to: https://api-docs.midtrans.com/#capture-transaction)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
getTransactionStatusB2B
public org.json.JSONObject getTransactionStatusB2B(String param) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/point_inquiry/{tokenId}` API request to Core API- Specified by:
getTransactionStatusB2Bin interfaceMidtransCoreApi- Parameters:
param- {String} of credit card (more detail refer to: https://api-docs.midtrans.com/#get-transaction-status-b2b)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
directRefundTransaction
public org.json.JSONObject directRefundTransaction(String param, Map<String,String> requestBody) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/{orderId}/status/b2b` API request to Core API- Specified by:
directRefundTransactionin interfaceMidtransCoreApi- Parameters:
param- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#direct-refund-transaction)requestBody- {Map Object} object of Core API JSON body as parameter, will be converted to JSON- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
denyTransaction
public org.json.JSONObject denyTransaction(String param) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/{orderId}/deny` API request to Core API- Specified by:
denyTransactionin interfaceMidtransCoreApi- Parameters:
param- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#deny-transaction)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
getBIN
public org.json.JSONObject getBIN(String binNumber) throws MidtransError
Description copied from interface:MidtransCoreApiDo `v1/bins/{bin}` API request to Core API- Specified by:
getBINin interfaceMidtransCoreApi- Parameters:
binNumber- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#bin-api)- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
createSubscription
public org.json.JSONObject createSubscription(Map<String,Object> subscriptionReq) throws MidtransError
Description copied from interface:MidtransCoreApiDo `v1/subscriptions` API request to Core API for Create subscription. (more detail refer to: http://api-docs.midtrans.com/#create-subscription)- Specified by:
createSubscriptionin interfaceMidtransCoreApi- Parameters:
subscriptionReq- {Map Object} object of Subscription request body- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
getSubscription
public org.json.JSONObject getSubscription(String subscriptionId) throws MidtransError
Description copied from interface:MidtransCoreApiDo `v1/subscriptions/{subscription_id}` Find subscription by id to see the subscription details. (more detail refer to: http://api-docs.midtrans.com/#get-subscription)- Specified by:
getSubscriptionin interfaceMidtransCoreApi- Parameters:
subscriptionId- {String} Subscription ID given by Midtrans- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
disableSubscription
public org.json.JSONObject disableSubscription(String subscriptionId) throws MidtransError
Description copied from interface:MidtransCoreApiDo `v1/subscriptions/{subscription_id}/disable` Make the subscription inactive (the subscription will not create transaction anymore)s. (more detail refer to: http://api-docs.midtrans.com/#disable-subscription)- Specified by:
disableSubscriptionin interfaceMidtransCoreApi- Parameters:
subscriptionId- {String} Subscription ID given by Midtrans- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
enableSubscription
public org.json.JSONObject enableSubscription(String subscriptionId) throws MidtransError
Description copied from interface:MidtransCoreApiDo `v1/subscriptions/{subscription_id}/enable` Make the subscription active (the subscription will create periodic transaction) (more detail refer to: http://api-docs.midtrans.com/#enable-subscription)- Specified by:
enableSubscriptionin interfaceMidtransCoreApi- Parameters:
subscriptionId- {String} Subscription ID given by Midtrans- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
updateSubscription
public org.json.JSONObject updateSubscription(String subscriptionId, Map<String,Object> subscriptionReq) throws MidtransError
Description copied from interface:MidtransCoreApiDo `v1/subscriptions/{subscription_id}` Update existing subscription details. (more detail refer to: http://api-docs.midtrans.com/#update-subscription)- Specified by:
updateSubscriptionin interfaceMidtransCoreApi- Parameters:
subscriptionId- {String} Subscription ID given by MidtranssubscriptionReq- {Map Object} object of Subscription request body- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
linkPaymentAccount
public org.json.JSONObject linkPaymentAccount(Map<String,Object> accountRequest) throws MidtransError
Description copied from interface:MidtransCoreApiDo `/v2/pay/account` to link customer account to be used for specific payment channels (more detail refer to: http://api-docs.midtrans.com/#create-pay-account)- Specified by:
linkPaymentAccountin interfaceMidtransCoreApi- Parameters:
accountRequest- {Map Object} object of create payment account request body- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
getPaymentAccount
public org.json.JSONObject getPaymentAccount(String accountId) throws MidtransError
Description copied from interface:MidtransCoreApiDo `v2/pay/account/{account_id}` find account by id to see the customer account details (more detail refer to: http://api-docs.midtrans.com/#get-pay-account)- Specified by:
getPaymentAccountin interfaceMidtransCoreApi- Parameters:
accountId- {String} Customer account id to be used for payment- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
unlinkPaymentAccount
public org.json.JSONObject unlinkPaymentAccount(String accountId) throws MidtransError
Description copied from interface:MidtransCoreApiDo `v2/pay/account/{account_id}/unbind` to unbind a linked customer account (more detail refer to: http://api-docs.midtrans.com/#unbind-pay-account)- Specified by:
unlinkPaymentAccountin interfaceMidtransCoreApi- Parameters:
accountId- {String} Customer account id to be used for payment- Returns:
- {JSONObject} - org.json Promise contains Object from JSON decoded response
- Throws:
MidtransError- when an exception was occurred during executing the request.
-
-