PostCustomerRequest not honoring buyer_information.merchant_customer_id
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu với console/create_customer.py và tái hiện PostCustomerRequest thông qua CustomerApi bằng các giá trị ví dụ. So sánh request đã được tuần tự hóa và buyer_information được trả về; hoàn tất khi merchant_customer_id được gửi và được giữ nguyên trong phản hồi API.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When I submit a PostCustomerRequest through CustomerApi the return_data shows the merchant_customer_id as None instead of the value I assigned to it.
Here's the code I'm using to test it:
# ENV_NAME=production python3 console/create_customer.py
import json
import os
import sys
from pathlib import Path
from CyberSource import (
CustomerApi,
PostCustomerRequest,
Tmsv2customersBuyerInformation,
Tmsv2customersClientReferenceInformation,
Tmsv2customersMerchantDefinedInformation,
)
from config.cybersource_configuration import (
CybersourceConfiguration,
)
# Environment (sandbox or production)
ENV_NAME = os.environ.get("ENV_NAME", "sandbox")
dir_path = os.path.dirname(os.path.realpath(__file__))
def del_none(d):
"""
Delete None values in Input Request Json body
"""
for key, value in list(d.items()):
if value is None:
del d[key]
elif isinstance(value, dict):
del_none(value)
return d
def write_log_audit(status):
print(f"[Sample Code Testing] [{Path(__file__).stem}] {status}")
buyer_information_merchant_customer_id = "user-1234567890"
buyer_information_email = "user@example.com"
buyer_information = Tmsv2customersBuyerInformation(
merchant_customer_id=buyer_information_merchant_customer_id,
email=buyer_information_email,
)
clientReferenceInformationCode = "TC50171_3"
clientReferenceInformation = Tmsv2customersClientReferenceInformation(
code=clientReferenceInformationCode
)
requestObj = PostCustomerRequest(
buyer_information=buyer_information.__dict__,
client_reference_information=clientReferenceInformation.__dict__,
)
requestObj = del_none(requestObj.__dict__)
requestObj = json.dumps(requestObj)
print(requestObj)
try:
configuration = CybersourceConfiguration()
client_config = configuration.get_configuration()
api_instance = CustomerApi(client_config)
return_data, status, body = api_instance.post_customer(requestObj)
print("\nAPI RESPONSE CODE : ", status)
print("\nAPI RESPONSE BODY : ", body)
print("\nAPI RESPONSE DATA : ", return_data)
write_log_audit(status)
except Exception as e:
write_log_audit(str(e))
print(f"\nException when calling CustomerApi->post_customer: {e}\n")
And here's the response I get back:
❯ python -m console.create_customer
API RESPONSE CODE : 201
API RESPONSE BODY : {"_links":{"self":{"href":"/tms/v2/customers/41ADA55F0277F548E063AF598E0AFAD3"},"paymentInstruments":{"href":"/tms/v2/customers/41ADA55F0277F548E063AF598E0AFAD3/payment-instruments"},"shippingAddresses":{"href":"/tms/v2/customers/41ADA55F0277F548E063AF598E0AFAD3/shipping-addresses"}},"id":"41ADA55F0277F548E063AF598E0AFAD3","buyerInformation":{"email":"user@example.com"},"clientReferenceInformation":{"code":"TC50171_3"},"metadata":{"creator":"creator_id_here"}}
API RESPONSE DATA : {'buyer_information': {'email': 'user@example.com',
'merchant_customer_id': None},
'client_reference_information': {'code': 'TC50171_3'},
'default_payment_instrument': None,
'default_shipping_address': None,
'embedded': None,
'id': '41ADA55F0277F548E063AF598E0AFAD3',
'links': {'_self': {'href': '/tms/v2/customers/41ADA55F0277F548E063AF598E0AFAD3'},
'payment_instruments': {'href': '/tms/v2/customers/41ADA55F0277F548E063AF598E0AFAD3/payment-instruments'},
'shipping_address': None},
'merchant_defined_information': None,
'metadata': {'creator': 'creator_id_here'},
'object_information': None}
[Sample Code Testing] [create_customer] 201
- Ngôn ngữ chính
- Python
- Star
- 29
- Fork
- 34
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CyberSource/cybersource-rest-samples-python
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 58/100
CyberSource/cybersource-rest-samples-python#65 · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 28/100
CyberSource/cybersource-rest-samples-python#53 · 1 bình luận ·
-
AMEX Account Updater Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Remove Typing dependencie Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
CyberSource/cybersource-rest-samples-python#45 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
CyberSource/cybersource-rest-samples-python#43 · 2 bình luận ·
Tất cả issue của CyberSource/cybersource-rest-samples-python
Issue tương tự
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Đang mởarea: harness bug status: needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Human-Agent-Society/reef#625 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
learningequality/kolibri#15351 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Name consistency Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
eellak/triplestore#65 · 1 bình luận ·