{"action":"opened","issue":{"url":"https://api.github.com/repos/colinodell/omnipay-bundle/issues/10","repository_url":"https://api.github.com/repos/colinodell/omnipay-bundle","labels_url":"https://api.github.com/repos/colinodell/omnipay-bundle/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/colinodell/omnipay-bundle/issues/10/comments","events_url":"https://api.github.com/repos/colinodell/omnipay-bundle/issues/10/events","html_url":"https://github.com/colinodell/omnipay-bundle/issues/10","id":309599387,"number":10,"title":"Question: How to get parameters for a custom gateway?","user":{"login":"pbalan","id":3174988,"avatar_url":"https://avatars0.githubusercontent.com/u/3174988?v=4","gravatar_id":"","url":"https://api.github.com/users/pbalan","html_url":"https://github.com/pbalan","followers_url":"https://api.github.com/users/pbalan/followers","following_url":"https://api.github.com/users/pbalan/following{/other_user}","gists_url":"https://api.github.com/users/pbalan/gists{/gist_id}","starred_url":"https://api.github.com/users/pbalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pbalan/subscriptions","organizations_url":"https://api.github.com/users/pbalan/orgs","repos_url":"https://api.github.com/users/pbalan/repos","events_url":"https://api.github.com/users/pbalan/events{/privacy}","received_events_url":"https://api.github.com/users/pbalan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-29T02:47:25Z","updated_at":"2018-03-29T02:47:25Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nThanks for the great work. Really appreciate it.\r\n\r\nI am trying to use this bundle in one of my project as follows:\r\n\r\n> config.yml\r\n```\r\nomnipay:\r\n    methods:\r\n        WechatPay_Mweb:\r\n            app_id: '%wechat_app_id%' #app_id\r\n            app_key: '%wechat_app_key%' #app_key\r\n            mch_id: '%wechat_mch_id%' #merchant_id\r\n            notify_url: '%wechat_notify_url%' #notify_url\r\n        Alipay_AopPage:\r\n            appId: '%alipay_app_id%' #app-id\r\n            appKey: '%alipay_app_key%' #appKey\r\n            signType: '%alipay_sign_type%' #signType\r\n            privateKey: '%alipay_private_key%' #privateKey\r\n            alipayPublicKey: '%alipay_public_key%' #publicKey\r\n            notifyUrl: '%alipay_notify_url%' #returnUrl\r\n```\r\n\r\n> services.yml\r\n```\r\nservice.pay.alipay:\r\n       class: Omnipay\\Alipay\\AopPageGateway\r\n       tags:\r\n            - { name: omnipay.gateway, alias: Alipay_AopPage }\r\n\r\nservice.pay.wechat:\r\n       class: Omnipay\\WechatPay\\MwebGateway\r\n       tags:\r\n            - { name: omnipay.gateway, alias: WechatPay_Mweb }\r\n\r\nservice.process.payment:\r\n       class: AppBundle\\Service\\ProcessPayment\r\n       arguments:\r\n            - '@doctrine_mongodb.odm.default_document_manager'\r\n            - '@omnipay'\r\n```\r\n\r\n> PaymentController.php\r\nThis controller has a route which determines transaction and paymentType and passes to `ProcessPayment` Service\r\n```\r\n$gatewayResponse = $this->processPaymentService->pay($transaction, $paymentType);\r\n```\r\n\r\n> ProcessPayment.php\r\n```\r\n/**\r\n     * ProcessPayment constructor.\r\n     * @param DocumentManager $dm\r\n     * @param Omnipay $omnipay\r\n     */\r\n    public function __construct(\r\n        DocumentManager $dm,\r\n        Omnipay $omnipay,\r\n    ) {\r\n        $this->dm = $dm;\r\n        $this->omnipay = $omnipay;\r\n    }\r\n\r\n    /**\r\n     * @param Document\\Transaction $transaction\r\n     * @param Document\\PaymentType $paymentType\r\n     * @throws \\Exception\r\n     * @return array\r\n     */\r\n    public function pay(Document\\Transaction $transaction, Document\\PaymentType $paymentType)\r\n    {\r\n         $paymentGateway = null;\r\n         switch ($paymentType) {\r\n               case: 'WECHAT': $paymentGateway = $this->omnipay->get('WechatPay_Mweb');\r\n                      break;\r\n               case: 'ALIPAY': $paymentGateway = $this->omnipay->get('Alipay_AopPage');\r\n                      break;\r\n               default:\r\n                      throw new \\Exception('Requested payment gateway is not implemented.', 401);\r\n                      break;\r\n         }\r\n        if (null !== $paymentGateway) {\r\n                $params = $paymentGateway->getDefaultParameters();\r\n                dump($params);\r\n                $order = [\r\n                     'app_id'            => '',\r\n                     'mch_id'            => '',\r\n                     'notify_url'        => '',\r\n                     'body'              => 'The test order',\r\n                     'out_trade_no'      => $transaction->getId(),\r\n                     'total_fee'         => 1, //=0.01\r\n                     'spbill_create_ip'  => '127.0.0.1',\r\n                     'fee_type'          => 'CNY'\r\n                ];\r\n                $request = $paymentGateway->purchase($order);\r\n                $response = $request->send();\r\n                dump($response->getData());\r\n        }\r\n    }\r\n```\r\n### Current result:\r\ndump($params) returns [] (An empty array)\r\n\r\n### Expected result:\r\n   Array of parameters configured in `config.yml`\r\n"}}
{"actor":{"display_login":"pbalan"}}