ignited / laravel-omnipay

Omnipay for Laravel & Lumen
MIT License
509 stars 100 forks source link

Securely translate underscores into camel case #16

Closed michael2h4ng closed 8 years ago

michael2h4ng commented 8 years ago

Gateway Alipay adopts underscore naming convention, and requires options like seller_email and return_url. Using only ucfirst() in the reflection function is not adequate, as it translates seller_email to getSeller_email, rather than getSellerEmail. This PR securely translates underscores into camel case.

alexw23 commented 8 years ago

Wouldn't submitting a PR to Alipay repo be a better option by creating alias functions? Just an idea?

michael2h4ng commented 8 years ago

Not sure about this... since Alipay uses underscore heavily. @lokielse What do you think?

lokielse commented 8 years ago
'alipay_express'                => [
            'driver'  => 'Alipay_Express',
            'options' => [
                'partner'     => 'xxxx',
                'key'         => 'xxxxx',
                'sellerEmail' => 'xxxx@xx.com',
                'signType'    => 'MD5',
                'caCertPath'  => 'xxx',
                'returnUrl'   => 'xxx',
                'notifyUrl'   => 'xxxx',
            ]
        ],//

You should use camel case like sellerEmail in config file.

michael2h4ng commented 8 years ago

@lokielse Gotcha. Thanks.