initial commit

This commit is contained in:
Geoff Taylor
2020-09-21 14:17:35 -04:00
committed by Geoff Taylor
parent 4967d60ca8
commit 55fa706370
2 changed files with 39 additions and 1 deletions
@@ -92,7 +92,7 @@ class Checkout_Mutation {
} else {
$value = ! empty( $input[ $fieldset_key ][ $input_key ] ) ? $input[ $fieldset_key ][ $input_key ] : null;
}
if ( $value ) {
$data[ $key ] = $value;
} elseif ( 'billing_country' === $key || 'shipping_country' === $key ) {
+38
View File
@@ -290,6 +290,44 @@ class CheckoutMutationTest extends \Codeception\TestCase\WPTestCase {
return $actual;
}
private function create_stripe_customer( $email ) {
$customer = \Stripe\Customer::create( array( 'email' => $email ) );
// use --debug flag to view.
codecept_debug( $customer );
return $customer;
}
private function create_stripe_source( $customer ) {
$source = \Stripe\Customer::createSource(
$customer['id'],
array( 'source' => 'tok_visa')
);
// use --debug flag to view.
codecept_debug( $source );
return $source;
}
private function create_stripe_payment_intent( $amount, $customer ) {
$payment_intent = \Stripe\PaymentIntent::create(
array(
'amount' => $amount,
'currency' => 'gbp',
'payment_method_types' => ['card'],
'customer' => $customer['id'],
'payment_method' => $customer['invoice_settings']['default_payment_method'],
)
);
// use --debug flag to view.
codecept_debug( $payment_intent );
return $payment_intent;
}
// tests
public function testCheckoutMutation() {
wp_set_current_user( $this->simple_customer );