Skip to content

Commit fd8c877

Browse files
committed
Refactor FedaPay integration to use 'first_name' and 'last_name' instead of 'firstname' and 'lastname; add status parameter for Transaction creation
1 parent be01940 commit fd8c877

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

docs/integrations/fedapay.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,13 @@ Initiate a payment transaction using EasySwitch's `TransactionDetail` class and
149149
transaction = TransactionDetail(
150150
transaction_id="TXN-123456", # Unique ID generated by your system
151151
provider=Provider.FEDAPAY,
152+
status=TransactionStatus.PENDING,
152153
amount=1000.0, # Amount in cents (10 XOF)
153154
currency=Currency.XOF,
154155
transaction_type=TransactionType.PAYMENT,
155156
customer=CustomerInfo(
156-
firstname="John",
157-
lastname="Doe",
157+
first_name="John",
158+
last_name="Doe",
158159
email="john.doe@email.com", # FedaPay doesn't support many customer with same email
159160
phone_number="+22990123456"
160161
),
@@ -557,8 +558,8 @@ The `CustomerInfo` class standardizes customer data across all providers:
557558
```python
558559
@dataclass
559560
class CustomerInfo:
560-
firstname: str
561-
lastname: str
561+
first_name: str
562+
last_name: str
562563
email: str
563564
phone_number: str
564565
id: Optional[str] = None
@@ -766,8 +767,8 @@ class FedaPayIntegration:
766767
currency=currency,
767768
transaction_type=TransactionType.PAYMENT,
768769
customer=CustomerInfo(
769-
firstname=customer_info["firstname"],
770-
lastname=customer_info["lastname"],
770+
first_name=customer_info["first_name"],
771+
last_name=customer_info["last_name"],
771772
email=customer_info["email"],
772773
phone_number=customer_info["phone_number"]
773774
),
@@ -848,8 +849,8 @@ def main():
848849

849850
# Test customer data
850851
customer = CustomerInfo(
851-
firstname="John",
852-
lastname="Doe",
852+
first_name="John",
853+
last_name="Doe",
853854
email="john.doe@example.com",
854855
phone_number="+22990000001" # Test number for success
855856
)
@@ -861,8 +862,8 @@ def main():
861862
currency=Currency.XOF,
862863
description="Test Payment with EasySwitch",
863864
customer_info={
864-
"firstname": customer.firstname,
865-
"lastname": customer.lastname,
865+
"first_name": customer.first_name,
866+
"last_name": customer.last_name,
866867
"email": customer.email,
867868
"phone_number": customer.phone_number
868869
},

0 commit comments

Comments
 (0)