Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion examples/in3.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def demo_pay() -> None:

try:
app = Buckaroo.from_env()

# CompanyName and CocNumber are optional billingCustomer fields for B2B
# orders. They ride along in the billingCustomer group; omit them for
# regular consumer payments.
billing = _customer()
billing.update({"CompanyName": "Acme B.V.", "CocNumber": "12345678"})

response = app.payments.create_payment(
"in3",
{
Expand All @@ -46,7 +53,7 @@ def demo_pay() -> None:
"article": [
{"Description": "Widget", "Quantity": "2", "GrossUnitPrice": "125.00"},
],
"billingCustomer": [_customer()],
"billingCustomer": [billing],
"shippingCustomer": [_customer()],
},
},
Expand Down
41 changes: 41 additions & 0 deletions tests/feature/payments/test_in3.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,47 @@ def test_in3_pay_returns_pending_with_redirect(self, buckaroo, mock_strategy):
},
)

def test_in3_pay_with_company_and_coc_flows_through_billing_customer(
self, buckaroo, mock_strategy
):
"""Optional B2B fields CompanyName and CocNumber (BTI-715) ride along in
the billingCustomer group on the regular In3 Pay flow, reaching the wire
as GroupType=Billingcustomer, GroupID=1.
"""
Helpers.assert_pay_returns_pending_with_redirect(
buckaroo,
mock_strategy,
method="in3",
invoice="INV-IN3-005",
payload_overrides={"amount": 25.00, "description": "Test in3 B2B pay"},
service_params={
"article": [
{"description": "Widget", "quantity": "2", "GrossUnitPrice": "12.50"},
],
"billingCustomer": [
{
"firstName": "John",
"lastName": "Doe",
"CompanyName": "Acme B.V.",
"CocNumber": "12345678",
},
],
"shippingCustomer": [
{"firstName": "John", "lastName": "Doe"},
],
},
)

billing = {
param["Name"]: param
for param in recorded_service_parameters(mock_strategy)
if param["GroupType"] == "Billingcustomer"
}
assert billing["Companyname"]["Value"] == "Acme B.V."
assert billing["Cocnumber"]["Value"] == "12345678"
assert billing["Companyname"]["GroupID"] == "1"
assert billing["Cocnumber"]["GroupID"] == "1"

def test_in3_authorize_returns_pending_with_redirect(self, buckaroo, mock_strategy):
def add_service_params(builder):
builder.add_parameter("route", "AbnB2b")
Expand Down
Loading