Skip to content

Commit

Permalink
feat: pass display_brand from stripe to swell card
Browse files Browse the repository at this point in the history
  • Loading branch information
awwit committed Apr 11, 2024
1 parent 72ac172 commit fbe8fc9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/payment/apple/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export default class StripeApplePayment extends Payment {
gateway: 'stripe',
token: paymentMethod,
brand: card.brand,
display_brand: card.display_brand,
exp_month: card.exp_month,
exp_year: card.exp_year,
last4: card.last4,
Expand Down
1 change: 1 addition & 0 deletions src/payment/google/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export default class StripeGooglePayment extends Payment {
gateway: 'stripe',
token: paymentMethod,
brand: card.brand,
display_brand: card.display_brand,
exp_month: card.exp_month,
exp_year: card.exp_year,
last4: card.last4,
Expand Down
1 change: 1 addition & 0 deletions src/utils/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ async function createPaymentMethod(stripe, cardElement, cart) {
exp_month: paymentMethod.card.exp_month,
exp_year: paymentMethod.card.exp_year,
brand: paymentMethod.card.brand,
display_brand: paymentMethod.card.display_brand,
address_check: paymentMethod.card.checks.address_line1_check,
cvc_check: paymentMethod.card.checks.cvc_check,
zip_check: paymentMethod.card.checks.address_postal_code_check,
Expand Down
12 changes: 8 additions & 4 deletions src/utils/stripe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ describe('utils/stripe', () => {
exp_month: 12,
exp_year: 99,
brand: 'Visa',
display_brand: 'cartes_bancaires',
address_check: 'address_line1_check',
cvc_check: 'cvc_check',
zip_check: 'address_zip_check',
zip_check: 'address_postal_code_check',
};

const stripe = {
Expand All @@ -33,10 +34,11 @@ describe('utils/stripe', () => {
exp_month: 12,
exp_year: 99,
brand: 'Visa',
display_brand: 'cartes_bancaires',
checks: {
address_line1_check: 'address_line1_check',
cvc_check: 'cvc_check',
address_postal_code_check: 'address_zip_check',
address_postal_code_check: 'address_postal_code_check',
},
},
},
Expand Down Expand Up @@ -112,10 +114,11 @@ describe('utils/stripe', () => {
exp_month: 12,
exp_year: 99,
brand: 'Visa',
display_brand: 'cartes_bancaires',
checks: {
address_line1_check: 'address_line1_check',
cvc_check: 'cvc_check',
address_zip_check: 'address_zip_check',
address_postal_code_check: 'address_postal_code_check',
},
},
},
Expand Down Expand Up @@ -153,10 +156,11 @@ describe('utils/stripe', () => {
exp_month: 12,
exp_year: 99,
brand: 'Visa',
display_brand: 'cartes_bancaires',
checks: {
address_line1_check: 'address_line1_check',
cvc_check: 'cvc_check',
address_zip_check: 'address_zip_check',
address_postal_code_check: 'address_postal_code_check',
},
},
});
Expand Down
1 change: 1 addition & 0 deletions types/card/snake.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ interface CardSnake extends BaseModel {
address_check?: 'unchecked' | 'pass' | 'fail';
billing?: Billing;
brand?: string;
display_brand?: string;
cvc_check?: 'unchecked' | 'pass' | 'fail';
exp_month?: number;
exp_year?: number;
Expand Down

0 comments on commit fbe8fc9

Please sign in to comment.