Skip to content

Commit

Permalink
Adds Checkout session token fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissrogers committed Aug 28, 2024
1 parent 2723b6f commit d24eefd
Show file tree
Hide file tree
Showing 3 changed files with 297 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/recurly/element/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ export default class Element extends Emitter {
*/
messageName (name) {
return `element:${this.id}:${name}`;
// element:21940812094ankfjankfawfwa:name
}

/**
Expand Down Expand Up @@ -409,6 +408,7 @@ export default class Element extends Emitter {
this.emit('submit', this);
}

// deprecated
notifyCoBadgeResult (body) {
this.emit('coBadge', { coBadgeSupport: body.coBadgeSupport, supportedBrands: body.supportedBrands });
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
{
"type": "checkout_session",
"id": "ANVq-oGYqYD4Qe5CNbXmvA",
"cancelUrl": null,
"cart": {
"coupons": [],
"currencies": [
{
"code": "USD"
}
],
"currency": {
"code": "USD"
},
"giftCards": [],
"lineItems": [],
"subscriptions": [
{
"addOns": [],
"planId": "basic",
"quantity": "1",
"quantityMutable": true,
"ephemeralId": "t-k9lRX0Xv7DFyXBThpA8YI"
}
]
},
"confirmUrl": "",
"finishUrl": null,
"flags": [
"accept_coupons"
],
"iconUrl": null,
"locale": "en-US",
"logoUrl": null,
"paymentMethods": [
{
"currencies": [
{
"cardTypes": [
"american_express",
"discover",
"diners_club",
"master",
"visa",
"jcb",
"union_pay",
"cartes_bancaires"
],
"code": "USD"
},
{
"cardTypes": [
"american_express",
"discover",
"diners_club",
"master",
"visa",
"jcb",
"union_pay",
"elo",
"hipercard"
],
"code": "BRL"
},
{
"cardTypes": [
"american_express",
"discover",
"diners_club",
"master",
"visa",
"jcb",
"union_pay",
"cartes_bancaires",
"bancontact"
],
"code": "EUR"
},
{
"cardTypes": [
"american_express",
"discover",
"diners_club",
"master",
"visa",
"jcb",
"union_pay",
"cartes_bancaires"
],
"code": "CHF"
}
],
"gateways": [],
"type": "credit_card"
},
{
"currencies": [
{
"cardTypes": [],
"code": "USD"
},
{
"cardTypes": [],
"code": "BRL"
},
{
"cardTypes": [],
"code": "EUR"
},
{
"cardTypes": [],
"code": "CHF"
}
],
"gateways": [
{
"code": "stripe-gateway-code",
"type": "stripe",
"credentials": {
"publishableKey": "pk_test_12345"
},
"currencies": [
{
"code": "USD"
}
]
},
{
"code": "test-adyen-code",
"type": "adyen",
"credentials": {
"clientKey": "test_12345"
},
"currencies": [
{
"code": "USD"
},
{
"code": "BRL"
},
{
"code": "EUR"
},
{
"code": "CHF"
}
]
},
{
"code": "test-adyen-code",
"type": "adyen",
"credentials": {
"clientKey": "test_12345"
},
"currencies": [
{
"code": "USD"
},
{
"code": "BRL"
},
{
"code": "EUR"
},
{
"code": "CHF"
}
]
}
],
"type": "apple_pay"
},
{
"currencies": [
{
"cardTypes": [],
"code": "USD"
},
{
"cardTypes": [],
"code": "BRL"
},
{
"cardTypes": [],
"code": "EUR"
},
{
"cardTypes": [],
"code": "CHF"
}
],
"gateways": [],
"type": "google_pay"
},
{
"currencies": [
{
"cardTypes": [],
"code": "BRL"
}
],
"gateways": [
{
"code": "test-adyen-code",
"type": "adyen",
"credentials": {
"clientKey": "test_12345"
},
"currencies": [
{
"code": "BRL"
}
]
}
],
"type": "boleto"
},
{
"currencies": [
{
"cardTypes": [],
"code": "EUR"
}
],
"gateways": [
{
"code": "test-adyen-code",
"type": "adyen",
"credentials": {
"clientKey": "test_12345"
},
"currencies": [
{
"code": "EUR"
}
]
}
],
"type": "ideal"
},
{
"currencies": [
{
"cardTypes": [],
"code": "EUR"
},
{
"cardTypes": [],
"code": "CHF"
}
],
"gateways": [
{
"code": "test-adyen-code",
"type": "adyen",
"credentials": {
"clientKey": "test_12345"
},
"currencies": [
{
"code": "EUR"
},
{
"code": "CHF"
}
]
}
],
"type": "sofort"
},
{
"currencies": [],
"gateways": [],
"type": "bacs"
}
],
"prefersColorScheme": null,
"primaryColor": "#2676a5",
"site": {
"addressRequirement": "full",
"name": "Test site",
"defaultCurrency": "USD"
},
"purchases": [],
"privacyPolicyUrl": "",
"tosUrl": "https://recurly.com/legal/terms/",
"updatedAt": "2024-08-28T19:17:11Z"
}
16 changes: 8 additions & 8 deletions packages/public-api-fixture-server/fixtures/tokens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ const CREATE_INVALID = {
module.exports = function tokens () {
const params = this.method === 'GET' ? this.query : this.request.body;
const { type } = params;
let token;

if (type === 'iban_bank_account') {
token = IBAN_BANK_ACCOUNT_TOKENS[params.iban];
return IBAN_BANK_ACCOUNT_TOKENS[params.iban];
} else if (type === 'bacs_bank_account') {
token = BACS_BANK_ACCOUNT_TOKENS[params.account_number];
return BACS_BANK_ACCOUNT_TOKENS[params.account_number];
} else if (type === 'three_d_secure_action_result') {
token = THREE_D_SECURE_TOKENS[params.three_d_secure_action_token_id];
return THREE_D_SECURE_TOKENS[params.three_d_secure_action_token_id];
} else if (type === 'becs_bank_account') {
token = BECS_BANK_ACCOUNT_TOKENS[params.account_number];
return BECS_BANK_ACCOUNT_TOKENS[params.account_number];
} else if ('account_number' in params) {
token = BANK_ACCOUNT_TOKENS[params.account_number];
return BANK_ACCOUNT_TOKENS[params.account_number];
} else if (type === 'checkout_session') {
return require('./checkout-session-token.json');
}

if (token) return token;
else return CREATE_INVALID;
return CREATE_INVALID;
};

0 comments on commit d24eefd

Please sign in to comment.