関数
Request::calculateItemPrices( array $payload )
説明 説明
LINE Pay has no fields for any of the above listed, and yet the total_full_price MUST equal the total_items_price + shipping_fee or /v3/payments/request will fail.
Therefore, we have to create fake products that represent discounts and other fees
Apparently the great mighty LINE didn’t anticipate any of this… What a shocker…
- $payload
(配列) (必須)
ファイル: src/Api/Request.php
public function calculateItemPrices($payload) { $order = $_SESSION['usces_entry']['order']; $usedpoint = $order['usedpoint'] * -1; $im_a_teapot = $usedpoint + $order['discount'] + $order['tax']; if ($order['discount'] !== 0) { $payload['packages'][0]['products'][] = [ 'name' => __('Discount', 'wcex_linepay'), 'quantity' => 1, 'price' => $order['discount'], ]; } if (get_option('usces')['tax_mode'] === 'exclude' && $order['tax'] > 0) { $payload['packages'][0]['products'][] = [ 'name' => __('consumption tax', 'usces'), 'quantity' => 1, 'price' => $order['tax'], ]; } if ($order['usedpoint'] > 0) { $payload['packages'][0]['products'][] = [ 'name' => __('Used points', 'usces'), 'quantity' => 1, 'price' => $usedpoint, ]; } $payload['packages'][0]['amount'] = $payload['packages'][0]['amount'] + $im_a_teapot; return $payload; }