From 4201b74098485e1a9868bb2673e0b96648de3355 Mon Sep 17 00:00:00 2001 From: Christopher Rogers Date: Thu, 11 Jan 2018 16:02:09 -0800 Subject: [PATCH] Adds support for logo assignment in PayPal flow - Only supported by the DirectStrategy Signed-off-by: Christopher Rogers --- lib/recurly/paypal/strategy/direct.js | 9 +++++++-- lib/recurly/paypal/strategy/index.js | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/recurly/paypal/strategy/direct.js b/lib/recurly/paypal/strategy/direct.js index f49596216..d7d2ded4c 100644 --- a/lib/recurly/paypal/strategy/direct.js +++ b/lib/recurly/paypal/strategy/direct.js @@ -12,11 +12,16 @@ export class DirectStrategy extends PayPalStrategy { this.emit('ready'); } - start () { - // TODO: More parameters here + get payload () { let payload = { description: this.config.display.displayName }; if (this.config.display.amount) payload.amount = this.config.display.amount; + if (this.config.display.logoImageUrl) payload.logoImageUrl = this.config.display.logoImageUrl; + if (this.config.display.headerImageUrl) payload.headerImageUrl = this.config.display.headerImageUrl; + return payload; + } + start () { + const { payload } = this; const frame = this.recurly.Frame({ path: '/paypal/start', payload }); frame.once('error', cause => this.error('paypal-tokenize-error', { cause })); frame.once('done', token => this.emit('token', token)); diff --git a/lib/recurly/paypal/strategy/index.js b/lib/recurly/paypal/strategy/index.js index 1b4830e36..b793070ad 100644 --- a/lib/recurly/paypal/strategy/index.js +++ b/lib/recurly/paypal/strategy/index.js @@ -15,7 +15,11 @@ const DISPLAY_OPTIONS = [ 'shippingAddressOverride', 'shippingAddressEditable', 'billingAgreementDescription', - 'landingPageType' + 'landingPageType', + + // Not compatible with Braintree options due to lack of support + 'logoImageUrl', + 'headerImageUrl' ]; const DEFAULTS = { display: {