Fixed issue with TwoCheckout integration

This commit is contained in:
Hillel Coren 2015-10-20 22:04:49 +03:00
parent 2c5667aacb
commit 392c1facc0
4 changed files with 11 additions and 8 deletions

View File

@ -235,7 +235,7 @@ class CheckData extends Command {
'updated_at' => new Carbon, 'updated_at' => new Carbon,
'account_id' => $client->account_id, 'account_id' => $client->account_id,
'client_id' => $client->id, 'client_id' => $client->id,
'message' => 'Recovered update to invoice [<a href="https://github.com/hillelcoren/invoice-ninja/releases/tag/v1.7.1" target="_blank">details</a>]', 'message' => 'Corrected client balance',
'adjustment' => $client->actual_balance - $activity->balance, 'adjustment' => $client->actual_balance - $activity->balance,
'balance' => $client->actual_balance, 'balance' => $client->actual_balance,
]); ]);

View File

@ -174,7 +174,8 @@ class PaymentController extends BaseController
$acceptedCreditCardTypes = $accountGateway->getCreditcardTypes(); $acceptedCreditCardTypes = $accountGateway->getCreditcardTypes();
// Handle offsite payments // Handle offsite payments
if ($useToken || $paymentType != PAYMENT_TYPE_CREDIT_CARD || $gateway->id == GATEWAY_EWAY) { if ($useToken || $paymentType != PAYMENT_TYPE_CREDIT_CARD
|| $gateway->id == GATEWAY_EWAY || $gateway->id == GATEWAY_TWO_CHECKOUT) {
if (Session::has('error')) { if (Session::has('error')) {
Session::reflash(); Session::reflash();
return Redirect::to('view/'.$invitationKey); return Redirect::to('view/'.$invitationKey);
@ -436,14 +437,15 @@ class PaymentController extends BaseController
} }
$response = $gateway->purchase($details)->send(); $response = $gateway->purchase($details)->send();
if ($accountGateway->gateway_id == GATEWAY_EWAY) { if ($accountGateway->gateway_id == GATEWAY_EWAY) {
$ref = $response->getData()['AccessCode']; $ref = $response->getData()['AccessCode'];
$token = $response->getCardReference(); } elseif ($accountGateway->gateway_id == GATEWAY_TWO_CHECKOUT) {
$ref = $response->getData()['cart_order_id'];
} else { } else {
$ref = $response->getTransactionReference(); $ref = $response->getTransactionReference();
} }
if (!$ref) { if (!$ref) {
$this->error('No-Ref', $response->getMessage(), $accountGateway); $this->error('No-Ref', $response->getMessage(), $accountGateway);
@ -467,7 +469,6 @@ class PaymentController extends BaseController
} elseif ($response->isRedirect()) { } elseif ($response->isRedirect()) {
$invitation->transaction_reference = $ref; $invitation->transaction_reference = $ref;
$invitation->save(); $invitation->save();
Session::put('transaction_reference', $ref); Session::put('transaction_reference', $ref);
Session::save(); Session::save();
$response->redirect(); $response->redirect();
@ -513,7 +514,7 @@ class PaymentController extends BaseController
} }
try { try {
if (method_exists($gateway, 'completePurchase')) { if (method_exists($gateway, 'completePurchase') && !$accountGateway->isGateway(GATEWAY_TWO_CHECKOUT)) {
$details = $this->paymentService->getPaymentDetails($invitation); $details = $this->paymentService->getPaymentDetails($invitation);
$response = $gateway->completePurchase($details)->send(); $response = $gateway->completePurchase($details)->send();
$ref = $response->getTransactionReference(); $ref = $response->getTransactionReference();

View File

@ -829,6 +829,8 @@ return array(
'oneclick_login_help' => 'Connect an account to login without a password', 'oneclick_login_help' => 'Connect an account to login without a password',
'referral_code_help' => 'Earn money by sharing our app online', 'referral_code_help' => 'Earn money by sharing our app online',
'enable_with_stripe' => 'Enable | Requires Stripe',
); );

View File

@ -133,7 +133,7 @@
<span data-bind="visible: is_recurring()" style="display: none"> <span data-bind="visible: is_recurring()" style="display: none">
{!! Former::checkbox('auto_bill') {!! Former::checkbox('auto_bill')
->label(trans('texts.auto_bill')) ->label(trans('texts.auto_bill'))
->text(trans('texts.enable')) ->text(trans('texts.enable_with_stripe'))
->data_bind("checked: auto_bill, valueUpdate: 'afterkeydown'") !!} ->data_bind("checked: auto_bill, valueUpdate: 'afterkeydown'") !!}
</span> </span>
{!! Former::text('po_number')->label(trans('texts.po_number_short'))->data_bind("value: po_number, valueUpdate: 'afterkeydown'") !!} {!! Former::text('po_number')->label(trans('texts.po_number_short'))->data_bind("value: po_number, valueUpdate: 'afterkeydown'") !!}