Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
529c7f4
commit c0e8561
Showing
23 changed files
with
492 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Summary | ||
|
||
# Checklist | ||
|
||
- [ ] Added changelog entry | ||
- [ ] Ran unit tests (Check the README for instructions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
namespace Braintree; | ||
|
||
/** | ||
* Braintree ApplePayGateway module | ||
* Manages Apple Pay for Web | ||
* | ||
* @package Braintree | ||
* @category Resources | ||
*/ | ||
class ApplePayGateway | ||
{ | ||
private $_gateway; | ||
private $_config; | ||
private $_http; | ||
|
||
public function __construct($gateway) | ||
{ | ||
$this->_gateway = $gateway; | ||
$this->_config = $gateway->config; | ||
$this->_config->assertHasAccessTokenOrKeys(); | ||
$this->_http = new Http($gateway->config); | ||
} | ||
|
||
public function registerDomain($domain) | ||
{ | ||
$path = $this->_config->merchantPath() . '/processing/apple_pay/validate_domains'; | ||
$response = $this->_http->post($path, ['url' => $domain]); | ||
if (array_key_exists('response', $response) && $response['response']['success']) | ||
{ | ||
return new Result\Successful; | ||
} | ||
else if (array_key_exists('apiErrorResponse', $response)) | ||
{ | ||
return new Result\Error($response['apiErrorResponse']); | ||
} | ||
} | ||
|
||
public function unregisterDomain($domain) | ||
{ | ||
$path = $this->_config->merchantPath() . '/processing/apple_pay/unregister_domain'; | ||
$this->_http->delete($path, ['url' => $domain]); | ||
return new Result\Successful; | ||
} | ||
|
||
public function registeredDomains() | ||
{ | ||
$path = $this->_config->merchantPath() . '/processing/apple_pay/registered_domains'; | ||
$response = $this->_http->get($path); | ||
if (array_key_exists('response', $response) && array_key_exists('domains', $response['response'])) | ||
{ | ||
$options = ApplePayOptions::factory($response['response']); | ||
return new Result\Successful($options, 'applePayOptions'); | ||
} | ||
else if (array_key_exists('apiErrorResponse', $response)) | ||
{ | ||
return new Result\Error($response['apiErrorResponse']); | ||
} | ||
else | ||
{ | ||
throw new Exception\Unexpected('expected response or apiErrorResponse'); | ||
} | ||
} | ||
} | ||
class_alias('Braintree\ApplePayGateway', 'Braintree_ApplePayGateway'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
namespace Braintree; | ||
|
||
/** | ||
* Braintree ApplePayOptions module | ||
* Manages configuration and options for Apple Pay | ||
* | ||
* @package Braintree | ||
* @category Resources | ||
* | ||
* @property-read array $domains | ||
*/ | ||
|
||
class ApplePayOptions extends Base | ||
{ | ||
public static function factory($attributes) | ||
{ | ||
$instance = new self(); | ||
$instance->_initialize($attributes); | ||
return $instance; | ||
} | ||
|
||
protected function _initialize($attributes) | ||
{ | ||
$this->_attributes = $attributes; | ||
} | ||
} | ||
class_alias('Braintree\ApplePayOptions', 'Braintree_ApplePayOptions'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
namespace Braintree; | ||
|
||
/** | ||
* Creates an instance of AuthorizationAdjustment as returned from a transaction | ||
* | ||
* @package Braintree | ||
* | ||
* @property-read string $amount | ||
* @property-read DateTime $timestamp | ||
* @property-read boolean $success | ||
* | ||
*/ | ||
|
||
class AuthorizationAdjustment extends Base | ||
{ | ||
public static function factory($attributes) | ||
{ | ||
$instance = new self(); | ||
$instance->_initialize($attributes); | ||
|
||
return $instance; | ||
} | ||
|
||
protected function _initialize($authorizationAdjustmentAttribs) | ||
{ | ||
$this->_attributes = $authorizationAdjustmentAttribs; | ||
} | ||
|
||
public function __toString() | ||
{ | ||
return __CLASS__ . '[' . Util::attributesToString($this->_attributes) . ']'; | ||
} | ||
} | ||
class_alias('Braintree\AuthorizationAdjustment', 'Braintree_Authorization_Adjustment'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
namespace Braintree; | ||
|
||
class FacilitatedDetails extends Base | ||
{ | ||
public static function factory($attributes) | ||
{ | ||
$instance = new self(); | ||
$instance->_initialize($attributes); | ||
return $instance; | ||
} | ||
|
||
protected function _initialize($attributes) | ||
{ | ||
$this->_attributes = $attributes; | ||
} | ||
|
||
/** | ||
* returns a string representation of the facilitated details | ||
* @return string | ||
*/ | ||
public function __toString() | ||
{ | ||
return __CLASS__ . '[' . | ||
Util::attributesToString($this->_attributes) .']'; | ||
} | ||
|
||
} | ||
class_alias('Braintree\FacilitatedDetails', 'Braintree_FacilitatedDetails'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.