From c9ae5c41906abd79b3979294470d3a9691a9e2fa Mon Sep 17 00:00:00 2001 From: maxzhao-bolt <92113047+maxzhao-bolt@users.noreply.github.com> Date: Thu, 17 Mar 2022 11:33:06 -0700 Subject: [PATCH] Adding PaymentMethod support into ApplicationContext (#237) --- const.go | 14 ++++++++++++++ types.go | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/const.go b/const.go index 7ba0d87..52db026 100644 --- a/const.go +++ b/const.go @@ -102,3 +102,17 @@ const ( ProductCategorySoftwareOther ProductCategory = "OTHER" ProductCategorySoftwareServices ProductCategory = "SERVICES" ) + +type PayeePreferred string // Doc: https://developer.paypal.com/api/orders/v2/#definition-payment_method +const ( + PayeePreferredUnrestricted PayeePreferred = "UNRESTRICTED" + PayeePreferredImmediatePaymentRequired PayeePreferred = "IMMEDIATE_PAYMENT_REQUIRED" +) + +type StandardEntryClassCode string // Doc: https://developer.paypal.com/api/orders/v2/#definition-payment_method +const ( + StandardEntryClassCodeTel StandardEntryClassCode="TEL" + StandardEntryClassCodeWeb StandardEntryClassCode="WEB" + StandardEntryClassCodeCcd StandardEntryClassCode="CCD" + StandardEntryClassCodePpd StandardEntryClassCode="PPD" +) diff --git a/types.go b/types.go index 9cbd68c..e43b972 100644 --- a/types.go +++ b/types.go @@ -198,11 +198,18 @@ type ( Locale string `json:"locale,omitempty"` ShippingPreference ShippingPreference `json:"shipping_preference,omitempty"` UserAction UserAction `json:"user_action,omitempty"` + PaymentMethod PaymentMethod `json:"payment_method,omitempty"` //LandingPage string `json:"landing_page,omitempty"` // not found in documentation ReturnURL string `json:"return_url,omitempty"` CancelURL string `json:"cancel_url,omitempty"` } + // Doc: https://developer.paypal.com/api/orders/v2/#definition-payment_method + PaymentMethod struct { + PayeePreferred PayeePreferred `json:"payee_preferred,omitempty"` + StandardEntryClassCode StandardEntryClassCode `json:"standard_entry_class_code,omitempty"` + } + // Authorization struct Authorization struct { ID string `json:"id,omitempty"`