@@ -92,7 +92,7 @@ func (p *paypalPaymentProvider) NewCharger(ctx context.Context, r *http.Request,
92
92
}
93
93
94
94
return func (amount uint64 , currency string , order * models.Order , invoiceNumber int64 ) (string , error ) {
95
- return p .charge (bp .PaypalID , bp .PaypalUserID , amount , currency , order , invoiceNumber )
95
+ return p .charge (log , bp .PaypalID , bp .PaypalUserID , amount , currency , order , invoiceNumber )
96
96
}, nil
97
97
}
98
98
@@ -154,16 +154,10 @@ func (p *paypalPaymentProvider) updatePaymentWithOrder(paymentID string, order *
154
154
}
155
155
156
156
_ , err := p .client .PatchPayment (paymentID , []paypalsdk.PaymentPatch {invoiceNumPatch , itemListPatch })
157
- if err != nil {
158
- switch e := err .(type ) {
159
- case * paypalsdk.ErrorResponse :
160
- fmt .Println (e .Details )
161
- }
162
- }
163
157
return err
164
158
}
165
159
166
- func (p * paypalPaymentProvider ) charge (paymentID string , userID string , amount uint64 , currency string , order * models.Order , invoiceNumber int64 ) (string , error ) {
160
+ func (p * paypalPaymentProvider ) charge (log logrus. FieldLogger , paymentID string , userID string , amount uint64 , currency string , order * models.Order , invoiceNumber int64 ) (string , error ) {
167
161
payment , err := p .client .GetPayment (paymentID )
168
162
if err != nil {
169
163
return "" , err
@@ -183,7 +177,12 @@ func (p *paypalPaymentProvider) charge(paymentID string, userID string, amount u
183
177
}
184
178
185
179
if err := p .updatePaymentWithOrder (paymentID , order , invoiceNumber ); err != nil {
186
- return "" , errors .Wrap (err , "Updating the PayPal payment with order details failed" )
180
+ log := log .WithError (err )
181
+ switch e := err .(type ) {
182
+ case * paypalsdk.ErrorResponse :
183
+ log = log .WithField ("err_detail" , e .Details )
184
+ }
185
+ log .Warn ("Failed to update transaction with details" )
187
186
}
188
187
189
188
executeResult , err := p .client .ExecuteApprovedPayment (paymentID , userID )
0 commit comments