Skip to content

pjmdr11/Assignment

Repository files navigation

Usage 1. Layout You can add WLinkButton to your xml layout

<payment.worldlink.com.wlinkpayment.widgets.WLinkButton
android:id="@+id/wlink_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:wlink_button_style="Rounded_Corners" />

And, Locate your xml WLink Button in your Java

WLinkButton wlinkButton = (WLinkButton) findViewById(R.id. wlink_button);

Or, use it in Java

WLinkButton wlinkButton = new WLinkButton();

And, add this java WLinkButton into your layout container.


2. Configure

You will need to provide a configuration file to WLinkButton. When creating a configuration file, you will need to instantiate WlinkConfig Class by passing ‘Merchant Name’, ‘Merchant App Id’, and a new instance of OnDetailsFetchedListener.

WlinkConfig wlinkConfig=new WlinkConfig(“MerchantName”, “Merchant App Id”, new Interface.OnDetailsFetchedListener() {
@Override
public void onDetailsFetched(WlinkDetails wlinkDetails) {
  //Returns all the details about the user when user proceeds for payment.

// Create a payment transaction with the amount and username returned from wlinkDetails.

//After Successful payment, pass the transaction id from the payment and the wlinkDetails to WLinkButton (Step 4)

}

  @Override
public void onError(String Error) {
     //returns error on failure
}
});

Note:

WlinkDetails class consists of:

  1. Username (String): User name of the World Link Customer.
  1. Amount to be Paid (Long): Total Amount of the pending/advance payment of the Customer.
  1. Has Advance Payment (Boolean): Determines the World Link Customer can pay in advance.
  1. Has Due (Boolean): Identifies the world link user have due left to be paid.
  1. VolumeRechargeId (Integer): Give the selected volume id of the user if user have volume based subscription.

3. Set Configuration to WLinkButton.

Finally set your config in your WLinkButton.

wLinkButton.setConfig(wlinkConfig);

4. Generate Transaction.

After the WlinkDetails are generated and a payment is successfully made, pass the transaction id of the payment and WlinkDetails to WLinkButton to generate a transaction.

wLinkButton.GenerateTransaction(wlinkDetails, “transactionId”, new Interface.OnInvoiceGenerateListener() {
@Override
public void onInvoiceGenerated(String InvoiceNumber) {
 
    // This will send request to WorldLink’s transaction to activate customer’s account.
}

@Override
public void onFailure(String Error) {
    //Returns error on process failure. 

}
});

On Successful transaction, it will return the invoice number which needs to be saved on merchant’s database along with the transaction details for further validation.

Transaction Flow:

  1. User logs in to Merchant Online payment system.
  2. On selecting “WORLDLINK” as payment option. He/She has to enter a valid worldlink username and he/she gets the details of his/her account status with amount to be paid. NOTE: If the account type of the user is Volume user and account has no due, he has to select the available packages. And if the due amount exists, it has to be paid first.
  3. User pays to the partner merchant and on successful payment, worldlink’s payment invoice is generated and mailed to the customer.

System Intereaction

enter image description here

The scenario visualized in above figure shows an overall communication diagram end to end from client to WORLDLINK system. In general, client sends request to partner merchant for transaction, where user logs in with valid partner merchant credential and confirms transaction for supplied valid WORLDLINK username. On successful transaction, invoice is mailed to the client from worldlink’s system.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages