lokielse / omnipay-alipay

Alipay driver for the Omnipay PHP payment processing library
MIT License
565 stars 155 forks source link

Parameter names doesn't conform to Omnipay standard #192

Open aimeos opened 2 years ago

aimeos commented 2 years ago

The used parameter names are not conforming to the Omnipay standard. Current:

$order = [
    'subject'      => 'The test order',
    'out_trade_no' => date('YmdHis') . mt_rand(1000, 9999),
    'total_amount' => '0.01',
    'product_code' => 'FAST_INSTANT_TRADE_PAY',
];

Official parameter names:

$order = [
    'description'              => 'The test order',
    'transactionId'      => date('YmdHis').mt_rand(1000, 9999),
    'amount'         => '0.01',
    'clientIp'  => 'ip_address',
    'currency'          => 'CNY',
    'language'         => 'zh'
];

This causes the driver not to work in applications implementing the Omnipay standard parameter names if no special handling is applied to convert the parameter names.

Furthermore, require to call the setBizContent() method is custom to the driver and will also don't work. Instead, the data must be passed to the purchase method.

$response = $gateway->purchase([
    'description'              => 'The test order',
    'transactionId'      => date('YmdHis').mt_rand(1000, 9999),
    'amount'         => '0.01',
    'clientIp'  => 'ip_address',
    'currency'          => 'CNY',
    'language'         => 'zh'
])->send();