Skip to content

Commit

Permalink
subscription payment fix and dropin UI updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mcjackson18 committed Oct 2, 2019
1 parent 738fbc6 commit b934945
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 2.2.4 - 2019-10-02

### Fixed

- Fixed date bug in _handleSubscriptionCharged method
- Fixed deprecation warning for locale in DropinUi template

### Changed

- Updated DropinUi button reset

## 2.2.3 - 2019-09-12

### Changed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "kuriousagency/commerce-braintree",
"description": "Braintree gateway for Commerce 2",
"type": "craft-plugin",
"version": "2.2.3",
"version": "2.2.4",
"keywords": [
"craft",
"cms",
Expand Down
1 change: 0 additions & 1 deletion src/assetbundles/dropinui/dist/js/DropinUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
}
return;
}
reset($submit);

if (dropinInstance.isPaymentMethodRequestable()) {
reset($submit);
Expand Down
4 changes: 2 additions & 2 deletions src/gateways/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ private function _createSubscriptionPayment($data, Currency $currency): Subscrip
$payment = new SubscriptionPayment([
'paymentAmount' => $data->transactions[0]->amount,
'paymentCurrency' => $currency,
'paymentDate' => DateTimeHelper::toDateTime($data->createdAt),
'paymentDate' => $data->createdAt,
'paymentReference' => $data->id,
'paid' => true,
'response' => Json::encode($data)
Expand Down Expand Up @@ -802,7 +802,7 @@ private function _handleSubscriptionCharged($data)
$currency = Commerce::getInstance()->getCurrencies()->getCurrencyByIso($defaultPaymentCurrency->iso);
$payment = $this->_createSubscriptionPayment($data, $currency);

Commerce::getInstance()->getSubscriptions()->receivePayment($subscription, $payment, DateTimeHelper::toDateTime($data->nextBillingDate));
Commerce::getInstance()->getSubscriptions()->receivePayment($subscription, $payment, $data->nextBillingDate);
}

private function _formatAddress($data) {
Expand Down
2 changes: 1 addition & 1 deletion src/templates/paymentForms/dropin-ui.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<input type="hidden" name="currency" value="{{ order.paymentCurrency }}">
<input type="hidden" name="email" value="{{ order.email }}">
<input type="hidden" name="address" value="{{ gateway.format3DSAddress(order)|json_encode }}">
<div data-id="dropInUi" {{ gateway.testMode ? 'data-sandbox' }} data-name="{{ storeName ?? siteName }}" data-locale="{{ craft.i18n.getLocaleData().id|replace('-','_') }}" data-subscription="{{ subscription }}" data-threedsecure="{{ threeDSecure }}" data-manage="{{ manage }}"></div>
<div data-id="dropInUi" {{ gateway.testMode ? 'data-sandbox' }} data-name="{{ storeName ?? siteName }}" data-locale="{{ craft.app.locale().id|replace('-','_') }}" data-subscription="{{ subscription }}" data-threedsecure="{{ threeDSecure }}" data-manage="{{ manage }}"></div>

0 comments on commit b934945

Please sign in to comment.