我想設置payumbundle與2checkout,我似乎不知道如何設置config.yml
,然後如何發送信息到2checkout。集成支付網關2checkout使用(omnipay payum和symfony)
在這之前我已經安裝PayPal快速結帳成功地與Payum和我一些什麼熟悉Payum(仍在學習Payum)
這是我迄今所做
我已經安裝在omnipay的2Checkout束
composer require "payum/omnipay-bridge" "omnipay/2checkout"
因爲我似乎無法在網上找到任何例子爲的2Checkout,我發現是在預塗最接近所以看着它example 這是我config.yml
payum:
security:
.....
contexts:
paypal:
paypal_express_checkout_nvp:
username: ....
password: ....
signature: ....
sandbox: true
2checkout:
omnipay:
type: TwoCheckout
options:
apiKey: ....
pri: ....
act: ....
testMode: true
這裏我的第一個問題出現
Q1:我怎麼知道什麼樣的信息在config.yml添加對不同的網關
現在移動到我的行爲中的代碼應該將信息發送到2checkout並將數據添加到數據庫。
$paymentName = 'TwoCheckout';
$storage = $this->get('payum')->getStorage('ClickTeck\featuresBundle\Entity\Orders');
$paymentDetails = $storage->create();
// insert order into database
$paymentDetails->setClientFname('First');
$paymentDetails->setClientLname('Last');
$paymentDetails->setClientPhone('111-111-111');
$paymentDetails->setClientEmail('[email protected]');
$paymentDetails->setInvoiceId('123');
$paymentDetails->setNumber('456');
$paymentDetails->setDescription('This is description');
$paymentDetails->setCurrencyCode('USD');
$paymentDetails->setTotalAmount('20');
$paymentDetails->setClientId($clientID);
$paymentDetails->setPaymentOption($paymentName);
$storage->update($paymentDetails);
$paymentDetails['amount'] = 20;
$paymentDetails["currency"] = 'USD';
$paymentDetails["description"] = "This is description";
$storage->update($paymentDetails);
$captureToken = $this->get('payum.security.token_factory')->createCaptureToken(
$paymentName,
$paymentDetails,
'payment_done' // the route to redirect after capture;
);
return $this->redirect($captureToken->getTargetUrl());
我使用我用貝寶和貝寶payum同一實體添加的數據在數據庫中的details
列,但爲的2Checkout它不加入的任何細節,並給出了一個錯誤Integrity constraint violation
這就是了解,由於細節不應該空,所以這裏是我的第二個問題
Q2:我們不能使用相同的實體用於不同的付款方式嗎?或者每種付款方式都應該有自己的實體?如果我們可以使用相同的實體,那麼爲什麼Payum不會爲details
列生成任何內容。我在這裏做錯了什麼
我真的很感激,如果有人可以幫助我,我需要看到一個例子,不僅僅是如何獲得2checkout集成的解釋。但是,解釋也將被讚賞。
UPDATE
這是我行動我的更新代碼,正準備這被添加到數據庫就好支付但交易失敗
$paymentName = 'TwoCheckout';
$storage = $this->get('payum')->getStorage('ClickTeck\featuresBundle\Entity\Orders');
/** @var Orders $details */
$details = $storage->create();
// insert order into database
$details->setClientFname($form->get('client_fname')->getData());
$details->setClientLname($form->get('client_lname')->getData());
$details->setClientPhone($form->get('client_phone')->getData());
$details->setClientEmail($form->get('client_email')->getData());
$details->setInvoiceId('123');
$details->setNumber('456');
$details->setDescription('This is description');
//change currency to dynamic before live
$details->setCurrencyCode('USD');
$details->setTotalAmount($cartTotal.".00");
$details->setClientId($clientID);
$details->setPaymentOption($paymentName);
$details["sid"] = '201308888';
$details["cart_order_id"] = '123456';
$details["merchant_order_id"] = '789';
$details["total"] = $cartTotal.".00";
$details["amount"] = $cartTotal.".00";
$details["tco_currency"] = 'USD';
$details['fixed'] = 'Y';
$details['skip_landing'] = 1;
$details['card_holder_name'] = 'Hold Name';
$details['street_address'] = 'Address 1';
$details['street_address2'] = 'Address 2';
$details['city'] = 'City';
$details['state'] = 'State';
$details['zip'] = '08610';
$details['country'] = 'USA';
$details['phone'] = '111-111-111';
$details['email'] = '[email protected]';
$details["name"] = 'a name';
$details["description"] = 'a description';
$details['card'] = new SensitiveValue(array(
'number' => $form->get('cardNumber')->getData(),
'cvv' => $form->get('cvv')->getData(),
'expiryMonth' => $form->get('expiryMonth')->getData(),
'expiryYear' => $form->get('expiryYear')->getData(),
'firstName' => $form->get('client_fname')->getData(),
));
$storage->update($details);
$captureToken = $this->get('payum.security.token_factory')->createCaptureToken(
$paymentName,
$details,
'payment_done' // the route to redirect after capture;
);
$details["returnUrl"] = $captureToken->getTargetUrl();
//return $this->redirect($captureToken->getTargetUrl());
return $this->forward('PayumBundle:Capture:do', array(
'payum_token' => $captureToken,
));
這是我看到的反應,我不能似乎明白爲什麼失敗
{"status":"failed","order":{"total_amount":500,"currency_code":"USD","details":{"sid":"201308888","cart_order_id":"123456","merchant_order_id":"789","total":"500.00","amount":"500.00","tco_currency":"USD","fixed":"Y","skip_landing":1,"card_holder_name":"Hold Name","street_address":"Address 1","street_address2":"Address 2","city":"city","state":"State","zip":"08610","country":"USA","phone":"111-111-111","email":"[email protected]","name":"a name","description":"a description","card":[],"returnUrl":"http:\/\/127.0.0.1:8000\/payment\/capture\/mjIo0HsxKQ1-DRISYUZ6fMZLUmOXD0-cPiOheqRqpH8","clientIp":"127.0.0.1","_reference":null,"_status":"failed","_status_code":null,"_status_message":null}}}
非常感謝回到我身邊,昨天我確實看到了getter和setters文件,知道要在config.yml中添加什麼。未來什麼是知道哪個文件具有getter和setter的簡單方法?在使用付款詳細信息正確設置config.yml後,詳細信息列現在正在保存數據,但卡信息未保存,我現在正在處理這些信息。由於Payum支持Omnipay,您是否知道如何通過信用卡詳細信息? – Baig 2015-02-11 09:35:26
當我們準備將數組發送到網關時,您是否有任何想法知道什麼是快速瞭解哪些參數需要發送,例如在這種情況下2checkout? – Baig 2015-02-11 13:38:16
卡的細節沒有被保存,我現在正在努力。 - 不能保存到數據庫中。這是正確的行爲。您必須使用symfony的轉發,而不是重定向,或者在您重定向用戶捕獲操作後請求信用卡。 – 2015-02-11 15:43:29