question

nick-pockeyt avatar image
nick-pockeyt asked nick-pockeyt edited

How to get order data from Merchant facing custom tender?

When using a merchant facing custom tender, I would like to get the order data from the intent. In sandbox mode I can get other data from the intent, such as EXTRA_AMOUNT, and EXTRA_ORDER_ID, but EXTRA_ORDER always returns null. The order is created in the Register app.

Intent cloverTenderIntent = getIntent();
Long amount = cloverTenderIntent.getLongExtra(Intents.EXTRA_AMOUNT, 0);
Long taxAmount = cloverTenderIntent.getLongExtra(Intents.EXTRA_TAX_AMOUNT, 0);
String orderId = cloverTenderIntent.getStringExtra(Intents.EXTRA_ORDER_ID)
Order order = cloverTenderIntent.getParcelableExtra(Intents.EXTRA_ORDER);

However order always returns null.

____________________________________

Edit
The full code is

@Overrideprotected void onCreate(Bundle savedInstanceState) {    
   super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mCloverTenderConnecter = new CloverTenderConnecter(this);
mCloverTenderConnecter.init();
Intent cloverTenderIntent = getIntent(); if (cloverTenderIntent != null && cloverTenderIntent.getAction().equals("clover.intent.action.MERCHANT_TENDER")) { CloverTransactionModel cloverTransaction = mCloverTenderConnecter.setCloverTransaction(cloverTenderIntent); } }

And my CloverTenderConnector class I have
public CloverTenderConnecter(Context context) {
   this.mContext = context;
this.mAccount = CloverAccount.getAccount(context);
this.mTenderConnector = new TenderConnector(context, mAccount, null);
}

public void init() {
mTenderConnector.connect();
} ...
public CloverTransactionModel setCloverTransaction(Intent intent) { return new CloverTransactionModel( intent.getLongExtra(Intents.EXTRA_AMOUNT, 0), intent.getLongExtra(Intents.EXTRA_TAX_AMOUNT, 0), intent.getStringExtra(Intents.EXTRA_ORDER_ID), intent.getStringExtra(Intents.EXTRA_MERCHANT_ID), intent.getParcelableExtra(Intents.EXTRA_ORDER) ); }

And here is what I have in my manifest.
<manifest 
   xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.pockeyt.cloverpay">

   <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<application android:name=".PockeytPay"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity
android:name=".ui.activities.MainActivity"
android:exported="true">

<intent-filter>
<action android:name="clover.intent.action.MERCHANT_TENDER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>
</application>
</manifest>
MerchantCustom Tenders
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

I looked at the code, and AFAICT you should be passed the current order object as EXTRA_ORDER. Note that, for whatever reason, customer facing tenders are not passed the order, just the order ID. Without having more information I can't really comment further. Can you check the intent action to ensure that it's actually "clover.intent.action.MERCHANT_TENDER"?

0 Likes 0 ·

0 Answers

Welcome to the
Clover Developer Community