Skip to content

Instantly share code, notes, and snippets.

@Xaxxis
Created November 29, 2019 07:20
Show Gist options
  • Save Xaxxis/32f5a8b13c5ad8e5532ec5aabef93c4a to your computer and use it in GitHub Desktop.
Save Xaxxis/32f5a8b13c5ad8e5532ec5aabef93c4a to your computer and use it in GitHub Desktop.
Workaround to hardcode aquiring bank on Magento 2.1.7 midtrans plugins
// this redirect.php file on app/code/Midtrans/Snap/Controller/Redirect.php
if ($quote->getBaseCustomerBalanceAmount() != 0) {
$balancAmount = array(
'id' => 'STORE CREDIT',
'price' => round($quote->getBaseCustomerBalanceAmount() * -1),
'quantity' => 1,
'name' => 'STORE CREDIT'
);
$item_details[] = $balancAmount;
}
$totalPrice = 0;
foreach ($item_details as $item) {
$totalPrice += $item['price'] * $item['quantity'];
}
//Please add this line for activated Acquiring Bank
//1. Add this line
$credit_card['bank'] = "BCA";
$transaction_details['gross_amount'] = $totalPrice;
$payloads = array();
$payloads['transaction_details'] = $transaction_details;
$payloads['item_details'] = $item_details;
$payloads['customer_details'] = $customer_details;
//2. Add creditcard array object to payloads object
$payloads['credit_card'] = $credit_card;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment