Skip to content

Commit

Permalink
Fixed project config bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mcjackson18 committed Mar 26, 2020
1 parent b13a270 commit 66d9bde
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ 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.3.5 - 2020-03-26

### Fixed

- Fixed project config bug

## 2.3.4 - 2020-03-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 Craft Commerce",
"type": "craft-plugin",
"version": "2.3.4",
"version": "2.3.5",
"keywords": [
"craft",
"cms",
Expand Down
14 changes: 11 additions & 3 deletions src/gateways/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Gateway extends BaseGateway

public $sendCartInfo;

public $gateway;
private $gateway;

private $customer;

Expand Down Expand Up @@ -508,6 +508,12 @@ public function getSubscriptionPlans(): array
return $output;
}

public function createSubscription($data)
{
return (object)$this->gateway->subscription()->create($data);

}

public function subscribe(User $user, BasePlan $plan, SubscriptionForm $parameters): SubscriptionResponseInterface
{
$source = $this->getPaymentSource($user->id);
Expand All @@ -516,12 +522,14 @@ public function subscribe(User $user, BasePlan $plan, SubscriptionForm $paramete
}
$plan = new Plan($plan);

$response = (object)$this->gateway->subscription()->create([
$data = [
'paymentMethodToken' => $source->token,
'planId' => $plan->reference,
'price' => $plan->price,
'merchantAccountId' => $this->merchantAccountId[$plan->getCurrency()],
]);
];

$response = $this->createSubscription($data);

if (!$response->success) {
//Craft::dd($response);
Expand Down

0 comments on commit 66d9bde

Please sign in to comment.