zai_payment 2.4.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,195 +0,0 @@
1
- # New User Parameters Implementation Summary
2
-
3
- This document summarizes the new body parameters added to the User resource for creating users in the Zai Payment gem.
4
-
5
- ## Added Parameters
6
-
7
- ### Individual User Parameters
8
-
9
- The following new parameters have been added for individual users:
10
-
11
- 1. **`drivers_license_number`** (String)
12
- - Driving license number of the user
13
- - Optional field for enhanced verification
14
-
15
- 2. **`drivers_license_state`** (String)
16
- - State section of the user's driving license
17
- - Optional field for enhanced verification
18
-
19
- 3. **`logo_url`** (String)
20
- - URL link to the logo
21
- - Optional field for merchant branding
22
-
23
- 4. **`color_1`** (String)
24
- - Primary color code (e.g., #FF5733)
25
- - Optional field for merchant branding
26
-
27
- 5. **`color_2`** (String)
28
- - Secondary color code (e.g., #C70039)
29
- - Optional field for merchant branding
30
-
31
- 6. **`custom_descriptor`** (String)
32
- - Custom text that appears on bank statements
33
- - Optional field for merchant branding
34
- - Shows on bundle direct debit statements, wire payouts, and PayPal statements
35
-
36
- 7. **`authorized_signer_title`** (String)
37
- - Job title of the authorized signer (e.g., "Director", "General Manager")
38
- - Required for AMEX merchants
39
- - Refers to the role/job title for the individual user who is authorized to sign contracts
40
-
41
- ### Company Object
42
-
43
- A new **`company`** parameter has been added to support business users. When provided, it creates a company for the user.
44
-
45
- #### Required Company Fields
46
-
47
- - **`name`** (String) - Company name
48
- - **`legal_name`** (String) - Legal business name (e.g., "ABC Pty Ltd")
49
- - **`tax_number`** (String) - ABN/TFN/Tax number
50
- - **`business_email`** (String) - Business email address
51
- - **`country`** (String) - Country code (ISO 3166-1 alpha-3)
52
-
53
- #### Optional Company Fields
54
-
55
- - **`charge_tax`** (Boolean) - Whether to charge GST/tax (true/false)
56
- - **`address_line1`** (String) - Business address line 1
57
- - **`address_line2`** (String) - Business address line 2
58
- - **`city`** (String) - Business city
59
- - **`state`** (String) - Business state/province
60
- - **`zip`** (String) - Business postal code
61
- - **`phone`** (String) - Business phone number
62
-
63
- ## Implementation Details
64
-
65
- ### Code Changes
66
-
67
- 1. **Field Mappings** - Added new fields to `FIELD_MAPPING` constant
68
- 2. **Company Field Mapping** - Added new `COMPANY_FIELD_MAPPING` constant
69
- 3. **Validation** - Added `validate_company!` method to validate company required fields
70
- 4. **Body Building** - Updated `build_user_body` to handle company object separately
71
- 5. **Company Body Builder** - Added `build_company_body` method to construct company payload
72
- 6. **Documentation** - Updated all method documentation with new parameters
73
-
74
- ### Special Handling
75
-
76
- - **Company Object**: Handled separately in `build_user_body` method
77
- - **Boolean Values**: Special handling for `charge_tax` to preserve `false` values
78
- - **Nested Structure**: Company fields are properly nested in the API payload
79
-
80
- ## Usage Examples
81
-
82
- ### Enhanced Verification with Driver's License
83
-
84
- ```ruby
85
- ZaiPayment.users.create(
86
- email: 'user@example.com',
87
- first_name: 'John',
88
- last_name: 'Doe',
89
- country: 'USA',
90
- drivers_license_number: 'D1234567',
91
- drivers_license_state: 'CA',
92
- government_number: '123-45-6789'
93
- )
94
- ```
95
-
96
- ### Merchant with Custom Branding
97
-
98
- ```ruby
99
- ZaiPayment.users.create(
100
- email: 'merchant@example.com',
101
- first_name: 'Jane',
102
- last_name: 'Smith',
103
- country: 'AUS',
104
- logo_url: 'https://example.com/logo.png',
105
- color_1: '#FF5733',
106
- color_2: '#C70039',
107
- custom_descriptor: 'MY STORE'
108
- )
109
- ```
110
-
111
- ### Business User with Company
112
-
113
- ```ruby
114
- ZaiPayment.users.create(
115
- email: 'director@company.com',
116
- first_name: 'John',
117
- last_name: 'Director',
118
- country: 'AUS',
119
- mobile: '+61412345678',
120
- authorized_signer_title: 'Director',
121
- company: {
122
- name: 'ABC Company',
123
- legal_name: 'ABC Company Pty Ltd',
124
- tax_number: '123456789',
125
- business_email: 'admin@abc.com',
126
- country: 'AUS',
127
- charge_tax: true,
128
- address_line1: '123 Business St',
129
- city: 'Melbourne',
130
- state: 'VIC',
131
- zip: '3000'
132
- }
133
- )
134
- ```
135
-
136
- ### AMEX Merchant Setup
137
-
138
- ```ruby
139
- ZaiPayment.users.create(
140
- email: 'amex.merchant@example.com',
141
- first_name: 'Michael',
142
- last_name: 'Manager',
143
- country: 'AUS',
144
- authorized_signer_title: 'Managing Director', # Required for AMEX
145
- company: {
146
- name: 'AMEX Shop',
147
- legal_name: 'AMEX Shop Pty Limited',
148
- tax_number: '51824753556',
149
- business_email: 'finance@amexshop.com',
150
- country: 'AUS',
151
- charge_tax: true
152
- }
153
- )
154
- ```
155
-
156
- ## Validation
157
-
158
- The following validations are in place:
159
-
160
- 1. **Company Validation**: When `company` is provided, all required company fields must be present
161
- 2. **Email Format**: Must be a valid email address
162
- 3. **Country Code**: Must be ISO 3166-1 alpha-3 format (3 letters)
163
- 4. **DOB Format**: Must be in DD/MM/YYYY format
164
- 5. **User ID**: Cannot contain '.' character
165
-
166
- ## Documentation Updates
167
-
168
- The following documentation files have been updated:
169
-
170
- 1. **`lib/zai_payment/resources/user.rb`** - Implementation
171
- 2. **`examples/users.md`** - Usage examples and patterns
172
- 3. **`docs/users.md`** - Field reference and comprehensive guide
173
- 4. **`readme.md`** - Quick start example
174
-
175
- ## Testing
176
-
177
- All new parameters have been tested and verified:
178
- - ✓ Drivers license parameters
179
- - ✓ Branding parameters (logo_url, colors, custom_descriptor)
180
- - ✓ Authorized signer title
181
- - ✓ Company object with all fields
182
- - ✓ Company validation (required fields)
183
- - ✓ Boolean handling (charge_tax false preservation)
184
-
185
- ## API Compatibility
186
-
187
- These changes are **backward compatible**. All new parameters are optional and existing code will continue to work without modifications.
188
-
189
- ## Related Files
190
-
191
- - `/lib/zai_payment/resources/user.rb` - Main implementation
192
- - `/examples/users.md` - Usage examples
193
- - `/docs/users.md` - Field reference
194
- - `/readme.md` - Quick start guide
195
-