関数
AmazonPay::filterActingOpts( array $opts )
Returns an associative array with all user inputed data concerning their contract with Amazon, as well as region specific data.
パラメータ パラメータ
- $opts
(配列) (必須)
ファイル: src/AmazonPay.php
public function filterActingOpts($opts) { $regionmetamap = [ 'us' => [ 'jsurl' => 'https://static-na.payments-amazon.com', 'integrationCentralUrl' => 'https://sellercentral.amazon.com/gp/pyop/seller/integrationcentral/', 'ledgerCurrency' => 'USD', 'checkoutLanguage' => 'en_US', ], 'eu' => [ 'jsurl' => 'https://static-eu.payments-amazon.com', 'integrationCentralUrl' => 'https://sellercentral-europe.amazon.com/gp/pyop/seller/integrationcentral/', 'ledgerCurrency' => 'EUR', 'checkoutLanguage' => 'en_GB', ], 'uk' => [ 'jsurl' => 'https://static-eu.payments-amazon.com', 'integrationCentralUrl' => 'https://sellercentral-europe.amazon.com/gp/pyop/seller/integrationcentral/', 'ledgerCurrency' => 'GBP', 'checkoutLanguage' => 'en_GB', ], 'jp' => [ 'jsurl' => 'https://static-fe.payments-amazon.com', 'integrationCentralUrl' => 'https://sellercentral-japan.amazon.com/gp/pyop/seller/integrationcentral/', 'ledgerCurrency' => 'JPY', 'checkoutLanguage' => 'ja_JP', ], ]; $opts['region'] = isset($opts['region']) ? strtolower($opts['region']) : 'jp'; $rmap = $regionmetamap[$opts['region']]; $opts['amzjsurl'] = $rmap['jsurl']; $opts['integrationCentralUrl'] = $rmap['integrationCentralUrl']; $opts['ledgerCurrency'] = $rmap['ledgerCurrency']; $opts['checkoutLanguage'] = $rmap['checkoutLanguage']; $host = ''; $url = esc_url_raw(wp_unslash(get_home_url())); if (!empty($url)) { $scheme = wp_parse_url($url, PHP_URL_SCHEME); $host = !$scheme ? 'https://' . $url : $url; } foreach (self::SDK_REQUIRED_FIELDS as $rfieldkey) { $opts[$rfieldkey] = isset($opts[$rfieldkey]) ? trim($opts[$rfieldkey]) : ''; } $opts['ipn_endpoint'] = !empty($opts['ipn_endpoint']) ? trim($opts['ipn_endpoint']) : $host; $opts['ipn_registered'] = isset($opts['ipn_registered']) ? (bool)(int)$opts['ipn_registered'] : false; $opts['ipn_verified'] = isset($opts['ipn_verified']) ? (bool)(int)$opts['ipn_verified'] : false; $opts['transaction_processing_type'] = isset($opts['transaction_processing_type']) ? $opts['transaction_processing_type'] : 'sync'; $opts['sync_with_order_status_changes'] = isset($opts['sync_with_order_status_changes']) ? $opts['sync_with_order_status_changes'] : 'off'; $opts['use_social_login'] = isset($opts['use_social_login']) ? $opts['use_social_login'] : 'on'; $opts['use_quickpay'] = isset($opts['use_quickpay']) ? $opts['use_quickpay'] : 'on'; $opts['quickpay_btn_position'] = isset($opts['quickpay_btn_position']) ? $opts['quickpay_btn_position'] : 'below'; $opts['quickpay_notes_field'] = isset($opts['quickpay_notes_field']) ? $opts['quickpay_notes_field'] : 'on'; $opts['quickpay_custom_order_fields'] = isset($opts['quickpay_custom_order_fields']) ? $opts['quickpay_custom_order_fields'] : 'on'; $opts['quickpay_custom_delivery_fields'] = isset($opts['quickpay_custom_delivery_fields']) ? $opts['quickpay_custom_delivery_fields'] : 'on'; $opts['quickpay_default_customer_address_details'] = isset($opts['quickpay_default_customer_address_details']) ? $opts['quickpay_default_customer_address_details'] : 'off'; $opts['address_priority'] = isset($opts['address_priority']) ? $opts['address_priority'] : 'amazon'; $opts['buttonColor'] = isset($opts['buttonColor']) ? $opts['buttonColor'] : 'Gold'; $opts['amazonpay_config'] = [ 'public_key_id' => $opts['public_key_id'], // RSA Public Key ID (this is not the Merchant or Seller ID) 'private_key' => $opts['private_key'], // Path to RSA Private Key (or a string representation) 'merchant_id' => $opts['merchant_id'], // Merchant/SellerID 'client_id' => $opts['client_id'], // Login With Amazon Client ID 'region' => $opts['region'], // us, eu, uk, jp 'currency_code' => usces_crcode('return'), // USD, EUR, GBP, JPY 'sandbox' => $opts['sandbox'], ]; return $opts; }