org.gsm.oneapi.payment
Class Charge

java.lang.Object
  extended by org.gsm.oneapi.payment.Charge

public class Charge
extends java.lang.Object


Field Summary
static boolean dumpRequestAndResponse
           
 
Constructor Summary
Charge(ServiceEndpoints endPoints, java.lang.String authorisationHeader)
          Creates a new instance of the Payment Charge API main interface.
 
Method Summary
 PaymentResponse charge(java.lang.String endUserId, java.lang.String referenceCode, java.lang.String description, java.lang.String currency, double amount, java.lang.String code, java.lang.String callbackURL, java.lang.String clientCorrelator, java.lang.String onBehalfOf, java.lang.String purchaseCategoryCode, java.lang.String channel, double taxAmount, java.lang.String serviceId, java.lang.String productId)
          Charge an amount to the end user's bill / mobile phone account.
static void main(java.lang.String[] args)
           
 PaymentResponse refund(java.lang.String endUserId, java.lang.String referenceCode, java.lang.String description, java.lang.String currency, double amount, java.lang.String code, java.lang.String clientCorrelator, java.lang.String originalServerReferenceCode, java.lang.String onBehalfOf, java.lang.String purchaseCategoryCode, java.lang.String channel, double taxAmount, java.lang.String serviceId, java.lang.String productId)
          Refund an amount to the end user's bill / mobile phone account.
 void setAuthorisationHeader(java.lang.String authorisationHeader)
          Can be used to update the service authorisation header
 void setEndpoints(ServiceEndpoints endPoints)
          Can be used to update the service endpoints
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dumpRequestAndResponse

public static boolean dumpRequestAndResponse
Constructor Detail

Charge

public Charge(ServiceEndpoints endPoints,
              java.lang.String authorisationHeader)
Creates a new instance of the Payment Charge API main interface. Requires endPoints to define the URL targets of the charge network call and authorisationHeader containing the username/password used for HTTP Basic authorisation with the OneAPI server.

Parameters:
endPoints - contains a set of service/ call specific endpoints
authorisationHeader - Base 64 encoded username/ password
See Also:
ServiceEndpoints, JSONRequest.getAuthorisationHeader(String, String)
Method Detail

setEndpoints

public void setEndpoints(ServiceEndpoints endPoints)
Can be used to update the service endpoints

Parameters:
endPoints - contains a set of service/ call specific endpoints
See Also:
ServiceEndpoints

setAuthorisationHeader

public void setAuthorisationHeader(java.lang.String authorisationHeader)
Can be used to update the service authorisation header

Parameters:
authorisationHeader - Base 64 encoded username/ password
See Also:
JSONRequest.getAuthorisationHeader(String, String)

charge

public PaymentResponse charge(java.lang.String endUserId,
                              java.lang.String referenceCode,
                              java.lang.String description,
                              java.lang.String currency,
                              double amount,
                              java.lang.String code,
                              java.lang.String callbackURL,
                              java.lang.String clientCorrelator,
                              java.lang.String onBehalfOf,
                              java.lang.String purchaseCategoryCode,
                              java.lang.String channel,
                              double taxAmount,
                              java.lang.String serviceId,
                              java.lang.String productId)
Charge an amount to the end user's bill / mobile phone account.

Parameters:
endUserId - (mandatory) is the end user ID; in this case their MSISDN including the 'tel:' protocol identifier and the country code preceded by '+'. i.e., tel:+16309700001. OneAPI also supports the Anonymous Customer Reference (ACR) if provided by the operator. Do not URL encode this value prior to passing
referenceCode - (mandatory, unique per charge event) is your reference for reconciliation purposes. The operator should include it in reports so that you can match their view of what has been sold with yours by matching the referenceCodes.
description - (mandatory) is the human-readable text to appear on the bill, so the user can easily see what they bought.
currency - (mandatory) is the 3-figure code as per ISO 4217. Note either amount and currency or code must be provided.
amount - (mandatory) can be a whole number or decimal. Note either amount and currency or code must be provided.
code - (mandatory) a code provided by the OneAPI implementation that is used to reference an operator price point. Note either amount and currency or code must be provided.
callbackURL - (optional) URL to post the result of the charge operation to
clientCorrelator - (optional) uniquely identifies this create charge request. If there is a communication failure during the charge request, using the same clientCorrelator when retrying the request allows the operator to avoid applying the same charge twice.
onBehalfOf - (optional) allows aggregators/partners to specify the actual payee.
purchaseCategoryCode - (optional) specifies the type/category of purchase e.g. "Video", "Game"
channel - (optional) can be "Wap", "Web", "SMS", depending on the source of user interaction
taxAmount - (optional) tax already charged by the merchant.
serviceId - (optional) The ID of the partner/merchant service
productId - (optional) combines with the serviceID to uniquely identify the product being purchased.
See Also:
PaymentResponse

refund

public PaymentResponse refund(java.lang.String endUserId,
                              java.lang.String referenceCode,
                              java.lang.String description,
                              java.lang.String currency,
                              double amount,
                              java.lang.String code,
                              java.lang.String clientCorrelator,
                              java.lang.String originalServerReferenceCode,
                              java.lang.String onBehalfOf,
                              java.lang.String purchaseCategoryCode,
                              java.lang.String channel,
                              double taxAmount,
                              java.lang.String serviceId,
                              java.lang.String productId)
Refund an amount to the end user's bill / mobile phone account.

Parameters:
endUserId - (mandatory) is the end user ID; in this case their MSISDN including the 'tel:' protocol identifier and the country code preceded by '+'. i.e., tel:+16309700001. OneAPI also supports the Anonymous Customer Reference (ACR) if provided by the operator. Do not URL encode this value prior to passing
referenceCode - (mandatory, unique per charge event) is your reference for reconciliation purposes. The operator should include it in reports so that you can match their view of what has been sold with yours by matching the referenceCodes.
description - (mandatory) is the human-readable text to appear on the bill, so the user can easily see what they bought.
currency - (mandatory) is the 3-figure code as per ISO 4217. Note either amount and currency or code must be provided.
amount - (mandatory) can be a whole number or decimal. Here means the amount to refund, which can be a full or partial refund of the original charge. Note either amount and currency or code must be provided.
code - (mandatory) a code provided by the OneAPI implementation that is used to reference an operator price point. Note either amount and currency or code must be provided.
clientCorrelator - (optional) uniquely identifies the refund request. If there is a communication failure during the refund request, using the same clientCorrelator when retrying the request allows the operator to avoid applying the same refund twice.
originalServerReferenceCode - (optional) if a serverReferenceCode was provided in the response to the orignal charge request, then you must include it in your refund request. Omitting it risks a policy exception being thrown.
onBehalfOf - (optional) allows aggregators/partners to specify the actual payee.
purchaseCategoryCode - (optional) specifies the type/category of purchase e.g. "Video", "Game"
channel - (optional) can be "Wap", "Web", "SMS", depending on the source of user interaction
taxAmount - (optional) tax already charged by the merchant.
serviceId - (optional) The ID of the partner/merchant service
productId - (optional) combines with the serviceID to uniquely identify the product being purchased.
See Also:
PaymentResponse

main

public static void main(java.lang.String[] args)