Skip to content

Commit 2e83e49

Browse files
authored
feat: fix bug due to null characters in descriptor when creating a payment intent (casdoor#3567)
1 parent 5661942 commit 2e83e49

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pp/airwallex.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (c *AirwallexClient) CreateIntent(r *PayReq) (*AirWallexIntentResp, error)
203203
"amount": r.Price,
204204
"merchant_order_id": orderId,
205205
"request_id": orderId,
206-
"descriptor": string([]rune(description)[:32]), // display to the customer.
206+
"descriptor": strings.ReplaceAll(string([]rune(description)[:32]), "\x00", ""),
207207
"metadata": map[string]interface{}{"description": description},
208208
"order": map[string]interface{}{"products": []map[string]interface{}{{"name": r.ProductDisplayName, "quantity": 1, "desc": r.ProductDescription, "image_url": r.ProductImage}}},
209209
"customer": map[string]interface{}{"merchant_customer_id": r.PayerId, "email": r.PayerEmail, "first_name": r.PayerName, "last_name": r.PayerName},

0 commit comments

Comments
 (0)