SwedbankPay / swedbank-pay-woocommerce-payments

Swedbank Pay Payments for WooCommerce (Beta)
https://wordpress.org/plugins/swedbank-pay-payments/
Apache License 2.0
3 stars 4 forks source link

PayeeReference being to long #33

Closed Npahlfer closed 4 years ago

Npahlfer commented 4 years ago

I get an exception where it says that PayeeReference is too long. I'm calling the payment method like so: process_payment($woocommerce_order).

Log ```08-17-2020 @ 10:45:31 - [debug] [0.3095] Client Exception. Check debug info: >>>>>>>> BEGIN PAYEX API CLIENT REQUEST DEBUG INFO >>>>>>>> Request Method: POST Request URL: https://api.externalintegration.payex.com/psp/creditcard/payments Request Headers: Accept: application/json Session-Id: 751ec1b0-c389-4929-a296-927de4cdfd5e Forwarded: for=188.151.223.181; proto=https Authorization: Bearer ... Content-Type: application/json; charset=utf-8 Content-Length: 3698 Request Body: { "payment": { "operation": "Purchase", "intent": "AutoCapture", "currency": "SEK", "prices": [ { "type": "CreditCard", "amount": 15000, "vatAmount": 0 } ], "description": "Order #1263", "payerReference": "7413cfd1-5284-5121-922c-fbd5184060f5", "generatePaymentToken": false, "generateRecurrenceToken": false, "pageStripdown": false, "userAgent": "mozilla\/5.0 (macintosh; intel mac os x 10.15; rv:80.0) gecko\/20100101 firefox\/80.0", "language": "en-US", "urls": { "completeUrl": "http:\/\/[COMPANY].se\/checkout\/order-received\/1263\/?key=wc_order_5f3a5fca673b4", "cancelUrl": "http:\/\/[COMPANY].se\/cart\/?cancel_order=true&order=wc_order_5f3a5fca673b4&order_id=1263&redirect&_wpnonce=cd82489086", "callbackUrl": "http:\/\/[COMPANY].se\/wc-api\/WC_Gateway_Swedbank_Pay_Cc\/?order_id=1263&key=wc_order_5f3a5fca673b4", "termsOfServiceUrl": "", "logoUrl": "" }, "payeeInfo": { "payeeId": "96237417-a485-4ec7-b0aa-0212f80b1122", "payeeName": "[COMPANY]", "orderReference": 1263, "payeeReference": "{\"id\":1263,\"parent_id\":0,\"status\":\"pending\",\"currency\":\"SEK\",\"version\":\"3.3.5\",\"prices_include_tax\":false,\"date_created\":{\"date\":\"2020-08-17 10:45:30.000000\",\"timezone_type\":1,\"timezone\":\"+00:00\"},\"date_modified\":null,\"discount_total\":0,\"discount_tax\":0,\"shipping_total\":0,\"shipping_tax\":0,\"cart_tax\":0,\"total\":0,\"total_tax\":0,\"customer_id\":0,\"order_key\":\"wc_order_5f3a5fca673b4\",\"billing\":{\"first_name\":\"\",\"last_name\":\"\",\"company\":\"\",\"address_1\":\"\",\"address_2\":\"\",\"city\":\"\",\"state\":\"\",\"postcode\":\"\",\"country\":\"\",\"email\":\"\",\"phone\":\"\"},\"shipping\":{\"first_name\":\"\",\"last_name\":\"\",\"company\":\"\",\"address_1\":\"\",\"address_2\":\"\",\"city\":\"\",\"state\":\"\",\"postcode\":\"\",\"country\":\"\"},\"payment_method\":\"\",\"payment_method_title\":\"\",\"transaction_id\":\"\",\"customer_ip_address\":\"188.151.223.181\",\"customer_user_agent\":\"mozilla\\\/5.0 (macintosh; intel mac os x 10.15; rv:80.0) gecko\\\/20100101 firefox\\\/80.0\",\"created_via\":\"\",\"customer_note\":\"\",\"date_completed\":null,\"date_paid\":null,\"cart_hash\":\"\",\"number\":\"1263\",\"meta_data\":[],\"line_items\":{\"132\":{}},\"tax_lines\":[],\"shipping_lines\":[],\"fee_lines\":[],\"coupon_lines\":[]}xvsneq" }, "riskIndicator": { "deliveryTimeFrameIndicator": "04", "shipIndicator": "01", "giftCardPurchase": false }, "creditCard": { "rejectCreditCards": false, "rejectDebitCards": false, "rejectConsumerCards": false, "rejectCorporateCards": false }, "prefillInfo": { "msisdn": "" }, "metadata": { "order_id": 1263 }, "cardholder": { "firstName": "", "lastName": "", "email": "", "msisdn": "", "homePhoneNumber": "", "workPhoneNumber": "", "billingAddress": { "firstName": "", "lastName": "", "email": "", "msisdn": "", "streetAddress": ", ", "coAddress": "", "city": "", "zipCode": "", "countryCode": "" } } } } Response Code: 400 Response Body: {"sessionId":"751ec1b0-c389-4929-a296-927de4cdfd5e","type":"https://api.payex.com/psp/errordetail/inputerror","title":"Error in input data","status":400,"instance":"http://api.externalintegration.payex.com/psp/creditcard/payments","detail":"Input validation failed, error description in problems node!","problems":[{"name":"Payment.PayeeInfo.PayeeReference","description":"The field PayeeReference must be a string with a maximum length of 50. The field PayeeReference must match the regular expression '[\\w\\-]*'"}]} <<<<<<<< END PAYEX API CLIENT REQUEST DEBUG INFO <<<<<<<< 08-17-2020 @ 10:45:31 - [debug] SwedbankPay\Core\Core::SwedbankPay\Core\Library\Methods\Card::initiateCreditCardPayment: API Exception: Error in input data. Input validation failed, error description in problems node! Payment.PayeeInfo.PayeeReference: The field PayeeReference must be a string with a maximum length of 50. The field PayeeReference must match the regular expression '[\w\-]*'```
Npahlfer commented 4 years ago

Solved by just inputting the order number instead of the whole order.

asbjornu commented 4 years ago

Glad you figured it out, @Npahlfer!