-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add card holder information (#119)
* feat: add cardholder information * test: add tests with card holder data * feat: add card holder form in CreateTokenActivity * feat: add card holder form in AuthenticationActivity * docs: update README to reflect card holder information * docs: update card expiry on README * chore: release version 4.2.0
- Loading branch information
Showing
17 changed files
with
502 additions
and
166 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,24 +31,24 @@ Maven: | |
<dependency> | ||
<groupId>com.xendit</groupId> | ||
<artifactId>xendit-android</artifactId> | ||
<version>4.1.2</version> | ||
<version>4.2.0</version> | ||
<type>pom</type> | ||
</dependency> | ||
``` | ||
|
||
Gradle: | ||
``` | ||
compile 'com.xendit:xendit-android:4.1.2' | ||
compile 'com.xendit:xendit-android:4.2.0' | ||
``` | ||
|
||
Ivy: | ||
``` | ||
<dependency org='com.xendit' name='xendit-android' rev='4.1.2'> | ||
<dependency org='com.xendit' name='xendit-android' rev='4.2.0'> | ||
<artifact name='xendit-android' ext='pom' ></artifact> | ||
</dependency> | ||
``` | ||
|
||
For more information, visit https://central.sonatype.dev/artifact/com.xendit/xendit-android/4.1.2/versions | ||
For more information, visit https://central.sonatype.com/artifact/com.xendit/xendit-android/4.2.0/versions | ||
|
||
**Note**: | ||
|
||
|
@@ -103,8 +103,9 @@ This function accepts parameters below: | |
|midLabel|String|*For switcher merchant only* Specific string value which labels any of your Merchant IDs (MID) set up with Xendit. This can be configured in the list of MIDs on your Dashboard settings. (If this is not included in a request, and you have more than 1 MID in your list, the transaction will proceed using your prioritized MID (first MID on your list)).| | ||
|
||
|
||
``` | ||
Card card = new Card("4000000000001091", "12", "2017", "123"); | ||
```java | ||
CardHolderData cardHolderData = new CardHolderData("John", "Doe", "[email protected]", "+628212223242526"); | ||
Card card = new Card("4000000000001091", "12", "2039", "123", cardHolderData); | ||
|
||
xendit.createSingleUseToken(card, 75000, true, "user-id", billingDetails, customer, currency, midLabel, new TokenCallback() { | ||
@Override | ||
|
@@ -129,8 +130,9 @@ xendit.createSingleUseToken(card, 75000, true, "user-id", billingDetails, custom | |
|customer|customer object|Xendit customer object| | ||
|midLabel|String|*For switcher merchant only* Specific string value which labels any of your Merchant IDs (MID) set up with Xendit. This can be configured in the list of MIDs on your Dashboard settings. (If this is not included in a request, and you have more than 1 MID in your list, the transaction will proceed using your prioritized MID (first MID on your list)).| | ||
|
||
``` | ||
Card card = new Card("4000000000001091", "12", "2017", "123"); | ||
```java | ||
CardHolderData cardHolderData = new CardHolderData("John", "Doe", "[email protected]", "+628212223242526"); | ||
Card card = new Card("4000000000001091", "12", "2039", "123"); | ||
|
||
xendit.createMultipleUseToken(card, "user-id", billingDetails, customer, midLabel, new TokenCallback() { | ||
@Override | ||
|
@@ -147,21 +149,22 @@ xendit.createMultipleUseToken(card, "user-id", billingDetails, customer, midLabe | |
``` | ||
|
||
### Creating a 3DS authentication | ||
|Parameter|Type|Description| | ||
|---------|----|-----------| | ||
|tokenId|String|a multiple-use token ID that is already created| | ||
|amount|String|Amount that will be used to create a token bundled with 3DS authentication| | ||
|currency|String|Currency of the transaction that will be submitted for 3DS authentication| | ||
|cardCvn|String|Card verification Number collected from card holder| | ||
|midLabel|String|*For switcher merchant only* Specific string value which labels any of your Merchant IDs (MID) set up with Xendit. This can be configured in the list of MIDs on your Dashboard settings. (If this is not included in a request, and you have more than 1 MID in your list, the transaction will proceed using your prioritized MID (first MID on your list)).| | ||
|onBehalfOf|String| Sub-account business ID for XenPlatform master account who intended to create a token for their sub-account. Will be set to `empty` if you omit the parameter| | ||
|midLabel|String|*For switcher merchant only* Specific string value which labels any of your Merchant IDs (MID) set up with Xendit. This can be configured in the list of MIDs on your Dashboard settings. (If this is not included in a request, and you have more than 1 MID in your list, the transaction will proceed using your prioritized MID (first MID on your list)).| | ||
|
||
``` | ||
| Parameter |Type|Description| | ||
|----------------|----|-----------| | ||
| tokenId |String|a multiple-use token ID that is already created| | ||
| amount |String|Amount that will be used to create a token bundled with 3DS authentication| | ||
| currency |String|Currency of the transaction that will be submitted for 3DS authentication| | ||
| cardCvn |String|Card verification Number collected from card holder| | ||
| cardHolderData |String|Additional information of the card holder data| | ||
| midLabel |String|*For switcher merchant only* Specific string value which labels any of your Merchant IDs (MID) set up with Xendit. This can be configured in the list of MIDs on your Dashboard settings. (If this is not included in a request, and you have more than 1 MID in your list, the transaction will proceed using your prioritized MID (first MID on your list)).| | ||
| onBehalfOf |String| Sub-account business ID for XenPlatform master account who intended to create a token for their sub-account. Will be set to `empty` if you omit the parameter| | ||
|
||
```java | ||
String tokenId = "sample-token-id"; | ||
int amount = 50000; | ||
CardHolderData cardHolderData = new CardHolderData("John", "Doe", "[email protected]", "+628212223242526"); | ||
|
||
xendit.createAuthentication(tokenId, amount, currency, cardCvn, "user-id", midLabel, new AuthenticationCallback() { | ||
xendit.createAuthentication(tokenId, amount, currency, cardCvn, cardHolderData, "user-id", midLabel, new AuthenticationCallback() { | ||
@Override | ||
public void onSuccess(Authentication authentication) { | ||
// Handle successful authentication | ||
|
@@ -179,7 +182,7 @@ xendit.createAuthentication(tokenId, amount, currency, cardCvn, "user-id", midLa | |
When you're ready to charge a card, use the private key on your backend to call the charge endpoint. See our API reference at https://xendit.github.io/apireference/#create-charge | ||
|
||
|
||
## Compability with ProGuard | ||
## Compatibility with ProGuard | ||
|
||
You will need to add the following to your proguard rules file (`proguard-rules.pro`). Else, proguard might affect deserialization of the authentication response body. | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
import com.xendit.Models.Address; | ||
import com.xendit.Models.BillingDetails; | ||
import com.xendit.Models.Card; | ||
import com.xendit.Models.CardHolderData; | ||
import com.xendit.Models.CardInfo; | ||
import com.xendit.Models.Customer; | ||
import com.xendit.Models.Token; | ||
|
@@ -45,6 +46,10 @@ public class CreateTokenActivity extends AppCompatActivity implements View.OnCli | |
private EditText expYearEditText; | ||
private EditText cvnEditText; | ||
private EditText amountEditText; | ||
private EditText cardHolderFirstNameEditText; | ||
private EditText cardHolderLastNameEditText; | ||
private EditText cardHolderEmailEditText; | ||
private EditText cardHolderPhoneNumberEditText; | ||
private EditText midLabelText; | ||
private Button createTokenBtn; | ||
private CheckBox multipleUseCheckBox; | ||
|
@@ -72,6 +77,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { | |
expYearEditText = (EditText) findViewById(R.id.expYearEditText_CreateTokenActivity); | ||
cvnEditText = (EditText) findViewById(R.id.cvnEditText_CreateTokenActivity); | ||
amountEditText = (EditText) findViewById(R.id.amountEditText_CreateTokenActivity); | ||
cardHolderFirstNameEditText = (EditText) findViewById(R.id.cardHolderFirstNameEditText_CreateTokenActivity); | ||
cardHolderLastNameEditText = (EditText) findViewById(R.id.cardHolderLastNameEditText_CreateTokenActivity); | ||
cardHolderEmailEditText = (EditText) findViewById(R.id.cardHolderEmailEditText_CreateTokenActivity); | ||
cardHolderPhoneNumberEditText = (EditText) findViewById(R.id.cardHolderPhoneNumberEditText_CreateTokenActivity); | ||
midLabelText = (EditText) findViewById(R.id.midLabelEditText_CreateTokenActivity); | ||
|
||
createTokenBtn = (Button) findViewById(R.id.createTokenBtn_CreateTokenActivity); | ||
|
@@ -87,6 +96,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { | |
expYearEditText.setText(year); | ||
cvnEditText.setText(R.string.cvnTest); | ||
amountEditText.setText(R.string.amountTest); | ||
cardHolderFirstNameEditText.setText(R.string.cardHolderFirstNameTest); | ||
cardHolderLastNameEditText.setText(R.string.cardHolderLastNameTest); | ||
cardHolderEmailEditText.setText(R.string.cardHolderEmailTest); | ||
cardHolderPhoneNumberEditText.setText(R.string.cardHolderPhoneNumberTest); | ||
} | ||
|
||
private void setActionBarTitle(String title) { | ||
|
@@ -108,10 +121,16 @@ public void onClick(View view) { | |
isMultipleUse = multipleUseCheckBox.isChecked(); | ||
shouldAuthenticate = !shouldAuthenticateCheckBox.isChecked(); | ||
|
||
CardHolderData cardHolderData = new CardHolderData(cardHolderFirstNameEditText.getText().toString(), | ||
cardHolderLastNameEditText.getText().toString(), | ||
cardHolderEmailEditText.getText().toString(), | ||
cardHolderPhoneNumberEditText.getText().toString()); | ||
|
||
Card card = new Card(cardNumberEditText.getText().toString(), | ||
expMonthEditText.getText().toString(), | ||
expYearEditText.getText().toString(), | ||
cvnEditText.getText().toString()); | ||
cvnEditText.getText().toString(), | ||
cardHolderData); | ||
|
||
Address billingAddress = new Address(); | ||
billingAddress.setCountry("ID"); | ||
|
@@ -123,22 +142,22 @@ public void onClick(View view) { | |
billingAddress.setPostalCode("123123"); | ||
|
||
BillingDetails billingDetails = new BillingDetails(); | ||
billingDetails.setMobileNumber("+6208123123123"); | ||
billingDetails.setMobileNumber("+628123123123"); | ||
billingDetails.setEmail("[email protected]"); | ||
billingDetails.setGivenNames("John"); | ||
billingDetails.setSurname("Hudson"); | ||
billingDetails.setPhoneNumber("+6208123123123"); | ||
billingDetails.setPhoneNumber("+628123123123"); | ||
billingDetails.setAddress(billingAddress); | ||
|
||
Address shippingAddress = billingAddress; | ||
Address[] customerAddress = { shippingAddress }; | ||
|
||
Customer customer = new Customer(); | ||
customer.setMobileNumber("+6208123123123"); | ||
customer.setMobileNumber("+628123123123"); | ||
customer.setEmail("[email protected]"); | ||
customer.setGivenNames("John"); | ||
customer.setSurname("Hudson"); | ||
customer.setPhoneNumber("+6208123123123"); | ||
customer.setPhoneNumber("+628123123123"); | ||
customer.setNationality("ID"); | ||
customer.setDateOfBirth("1990-04-13"); | ||
customer.setDescription("test user"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ | |
<string name="expMonthTest">12</string> | ||
<string name="cvnTest">123</string> | ||
<string name="amountTest">123000</string> | ||
<string name="cardHolderFirstNameTest">John</string> | ||
<string name="cardHolderLastNameTest">Hudson</string> | ||
<string name="cardHolderEmailTest">[email protected]</string> | ||
<string name="cardHolderPhoneNumberTest">+628123123123</string> | ||
<string name="create_token">Create Token</string> | ||
<string name="store_cvn">Store CVN</string> | ||
</resources> |
Oops, something went wrong.