Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2d43368
Apple Pay: WIP
ChaseWiseman Nov 21, 2016
d9b96e2
Apple Pay: add single product page handling
ChaseWiseman Nov 23, 2016
97cccdd
[Apple Pay] add settings descriptions
ChaseWiseman Nov 23, 2016
bc9037e
[Apple Pay] clear todos
ChaseWiseman Nov 23, 2016
8a642d3
[Apple Pay] only allow Buy Now for in-stock products
ChaseWiseman Nov 23, 2016
ffcd632
[Apple Pay] use session for payment response data
ChaseWiseman Nov 23, 2016
42930c8
[Apple Pay] allow resuming failed orders
ChaseWiseman Nov 23, 2016
0d44371
[Apple Pay] tweaks and versioning
ChaseWiseman Nov 23, 2016
f3dbdaa
[Apple Pay] tweak availability and session data
ChaseWiseman Nov 23, 2016
9fc4f2e
[Apple Pay] make the order note expiry date optional
ChaseWiseman Nov 23, 2016
5ce26e8
Apple Pay: add response class for better data handling
ChaseWiseman Nov 25, 2016
85387d2
Apple Pay: fix existing session error when the JS handler is re-initi…
ChaseWiseman Nov 25, 2016
b53eee9
Apple Pay: clean up the order creation methods
ChaseWiseman Nov 25, 2016
65753ef
Apple Pay: add request/response class unit tests
ChaseWiseman Nov 26, 2016
601525a
Apple Pay: clean up JS and improve payment request handling
ChaseWiseman Nov 28, 2016
0a2fdb6
Apple Pay: refine settings page based on feedback
ChaseWiseman Dec 1, 2016
35161f1
Apple Pay: better debug messaging
ChaseWiseman Dec 1, 2016
b2bb753
Apple Pay: tweaks for better log messaging & WC compat
ChaseWiseman Dec 1, 2016
7929f44
[Compat] Add helper to normalize a WC screen ID
bekarice Dec 12, 2016
c50a067
Apple Pay: add button color setting & improve styling
ChaseWiseman Jan 27, 2017
e12b3b4
Merge branch 'master' into apple-pay
ChaseWiseman Mar 29, 2017
ccfe7ea
Merge branch 'master' into apple-pay
ChaseWiseman Jun 1, 2017
9e7857d
Apple Pay: add filter for activating the feature
ChaseWiseman Jun 1, 2017
095ba67
Apple Pay: improve the frontend JS UX
ChaseWiseman Jun 1, 2017
2b7f802
Apple Pay: introduce the add_shipping() order helper method
ChaseWiseman Jun 1, 2017
64b3264
Apple Pay: WC 3.0 combat, drop 2.5 support
ChaseWiseman Jun 1, 2017
0bca613
Apple Pay: display a single subtotal instead of line items on the pay…
ChaseWiseman Jun 1, 2017
ebca60e
Apple Pay: improve logging, mask unnecessary info
ChaseWiseman Jun 1, 2017
5f0a802
Add shipping & tax calculation for single product page purchases
ChaseWiseman Jun 13, 2017
de895d1
Remove shipping & tax Buy Now settings
ChaseWiseman Jun 13, 2017
b7ee560
Remove new order actions since payment request data is final
ChaseWiseman Jun 13, 2017
817dc94
Fix WC 2.6 method call
ChaseWiseman Jun 14, 2017
f41efdb
Remove discount & fee filters for Buy Now until those are supported
ChaseWiseman Jun 14, 2017
c87b242
Fix incorrect variable
ChaseWiseman Jun 14, 2017
f24c6b5
Clean up some of the shipping logic when creating a new order
ChaseWiseman Jun 14, 2017
30e470c
Use a switch when creating an order for better readability
ChaseWiseman Jun 14, 2017
d5d8033
Pass shipping methods calculated at Buy Now for new orders
ChaseWiseman Jun 14, 2017
c65d5cd
Apple Pay: finish shipping & tax calculation for all flows
ChaseWiseman Jul 1, 2017
ba9b5bb
Merge branch 'master' into apple-pay
ChaseWiseman Jul 10, 2017
2db7921
Apple Pay: update version number and doc standards
ChaseWiseman Jul 10, 2017
5e19392
Apple Pay: remove old WP 4.6 compatibility logic
ChaseWiseman Jul 10, 2017
a20865d
Apple Pay: add a separate build method for the Apple Pay handler
ChaseWiseman Jul 10, 2017
054d8fd
Apple Pay: load files from the gateway plugin
ChaseWiseman Jul 12, 2017
ec537cd
Apple Pay: add class_exists wrappers
ChaseWiseman Jul 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
>
<testsuites>
<testsuite name="unit">
<directory suffix=".php">./tests/unit</directory>
<directory suffix=".php">./tests/unit/</directory>
<directory suffix=".php">./tests/unit/*</directory>
</testsuite>
<testsuite name="integration">
<directory suffix=".php">./tests/integration</directory>
Expand Down
9 changes: 9 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,19 @@ public function load_framework() {
require_once( $this->framework_dir . '/woocommerce/compatibility/abstract-sv-wc-data-compatibility.php' );
require_once( $this->framework_dir . '/woocommerce/compatibility/class-sv-wc-order-compatibility.php' );

// API
require_once( $this->framework_dir . '/woocommerce/api/interface-sv-wc-api-request.php' );
require_once( $this->framework_dir . '/woocommerce/api/interface-sv-wc-api-response.php' );
require_once( $this->framework_dir . '/woocommerce/api/abstract-sv-wc-api-json-request.php' );
require_once( $this->framework_dir . '/woocommerce/api/abstract-sv-wc-api-json-response.php' );

// payment gateways
require_once( $this->framework_dir . '/woocommerce/payment-gateway/class-sv-wc-payment-gateway-helper.php' );
require_once( $this->framework_dir . '/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-token.php' );
require_once( $this->framework_dir . '/woocommerce/payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php' );
require_once( $this->framework_dir . '/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-request.php' );
require_once( $this->framework_dir . '/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-response.php' );
require_once( $this->framework_dir . '/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-payment-response.php' );


echo "Loaded Framework..." . PHP_EOL;
Expand Down
66 changes: 66 additions & 0 deletions tests/unit/payment-gateway/apple-pay-api-request.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

namespace SkyVerge\WC_Plugin_Framework\Unit_Tests;

use \WP_Mock as Mock;

/**
* Unit tests for \SV_WC_Payment_Gateway_Apple_Pay_API_Request
*
* @since 4.7.0-dev
*/
class Payment_Gateway_Apple_Pay_API_Request extends Test_Case {


/**
* Tests for \SV_WC_Payment_Gateway_Apple_Pay_API_Request::set_merchant_data()
*
* @since 4.7.0-dev
* @dataProvider provider_test_set_merchant_data
*/
public function test_set_merchant_data( $merchant_id, $domain_name, $display_name, $expected ) {

$gateway = $this->getMock( 'SV_WC_Payment_Gateway' );

$request = new \SV_WC_Payment_Gateway_Apple_Pay_API_Request( $gateway );

$request->set_merchant_data( $merchant_id, $domain_name, $display_name );

$this->assertEquals( $expected, $request->to_string() );
}


/**
* Data provider for test_set_merchant_data()
*
* @since 4.5.0
* @return array
*/
public function provider_test_set_merchant_data() {

return array(
array(
'merchant',
'https://domain.com',
'Domain',
json_encode( array(
'merchantIdentifier' => 'merchant',
'domainName' => 'domain.com',
'displayName' => 'Domain',
) ),
),
array(
'merchant',
'http://domain.com',
'Domain',
json_encode( array(
'merchantIdentifier' => 'merchant',
'domainName' => 'domain.com',
'displayName' => 'Domain',
) ),
),
);
}


}
112 changes: 112 additions & 0 deletions tests/unit/payment-gateway/apple-pay-api-response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?php

namespace SkyVerge\WC_Plugin_Framework\Unit_Tests;

use \WP_Mock as Mock;

/**
* Unit tests for \SV_WC_Payment_Gateway_Apple_Pay_API_Response
*
* @since 4.7.0-dev
*/
class Payment_Gateway_Apple_Pay_API_Response extends Test_Case {


/**
* Test for \SV_WC_Payment_Gateway_Apple_Pay_Payment_Response::get_status_code()
*
* @since 4.7.0-dev
*/
public function test_get_status_code() {

$response = new \SV_WC_Payment_Gateway_Apple_Pay_API_Response( $this->get_error_response_data() );

$this->assertEquals( '123', $response->get_status_code() );
}


/**
* Test for blank \SV_WC_Payment_Gateway_Apple_Pay_Payment_Response::get_status_code()
*
* @since 4.7.0-dev
*/
public function test_get_status_code_blank() {

$response = new \SV_WC_Payment_Gateway_Apple_Pay_API_Response( '' );

$this->assertNull( $response->get_status_code() );
}


/**
* Test for \SV_WC_Payment_Gateway_Apple_Pay_Payment_Response::get_status_message()
*
* @since 4.7.0-dev
*/
public function test_get_status_message() {

$response = new \SV_WC_Payment_Gateway_Apple_Pay_API_Response( $this->get_error_response_data() );

$this->assertEquals( 'Error', $response->get_status_message() );
}


/**
* Test for blank \SV_WC_Payment_Gateway_Apple_Pay_Payment_Response::get_status_message()
*
* @since 4.7.0-dev
*/
public function test_get_status_message_blank() {

$response = new \SV_WC_Payment_Gateway_Apple_Pay_API_Response( '' );

$this->assertNull( $response->get_status_message() );
}


/**
* Test for \SV_WC_Payment_Gateway_Apple_Pay_Payment_Response::get_merchant_session()
*
* @since 4.7.0-dev
*/
public function test_get_merchant_session() {

$data = json_encode( array( 'response' ) );

$response = new \SV_WC_Payment_Gateway_Apple_Pay_API_Response( $data );

$this->assertEquals( $data, $response->get_merchant_session() );
}


/**
* Test for blank \SV_WC_Payment_Gateway_Apple_Pay_Payment_Response::get_merchant_session()
*
* @since 4.7.0-dev
*/
public function test_get_merchant_session_blank() {

$response = new \SV_WC_Payment_Gateway_Apple_Pay_API_Response( '' );

$this->assertEquals( '', $response->get_merchant_session() );
}


/**
* Gets an example error response.
*
* @since 4.7.0-dev
* @return string
*/
private function get_error_response_data() {

$data = array(
'statusCode' => '123',
'statusMessage' => 'Error',
);

return json_encode( $data );
}


}
Loading