Skip to content

Commit eecafa9

Browse files
committed
adds support for product_code
1 parent 1aa4ee0 commit eecafa9

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ This is how you topup a phone in another country.
178178

179179
### Example:
180180

181-
`idtbeyond_iatu.post_topup "amount", "carrier_code", "country_code", "mobile_number"`
181+
`idtbeyond_iatu.post_topup "product_code" , amount", "carrier_code", "country_code", "mobile_number"`
182182

183183
### Request:
184184

185185
```ruby
186-
idtbeyond_iatu.post_topup "1000", "Claro", "GT", "50247280123"
186+
idtbeyond_iatu.post_topup "76560", "1000", "Claro", "GT", "50247280123"
187187
```
188188

189189
### Response:

lib/idtbeyond/services/imtu.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ def get_status
7777
false
7878
end
7979

80-
def post_topup(amount, carrier_code, country_code, mobile_number )
80+
def post_topup(product_code, amount, carrier_code, country_code, mobile_number )
8181
client_transaction_id = @app_id + "-" + "%06d" % Random.rand(0..999999)
8282
response = @conn.post "/v1/iatu/topups", {
83+
:product_code => product_code,
8384
:country_code => country_code,
8485
:carrier_code => carrier_code,
8586
:client_transaction_id => client_transaction_id,

spec/imtu_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
stub_request(:post, "https://api.idtbeyond.com/v1/iatu/topups").
142142
with(
143143
:body => {
144+
"product_code"=>"76560",
144145
"amount"=>"amount",
145146
"carrier_code"=>"carrier-code",
146147
"client_transaction_id"=>/app-id-\d+/,
@@ -156,7 +157,7 @@
156157
"X-Idt-Beyond-App-Id"=>"app-id",
157158
"X-Idt-Beyond-App-Key"=>"app-key"}).
158159
to_return(:status => 200, :body => "{\"success\":true}", :headers => {})
159-
response = @idtbeyond.post_topup "amount", "carrier-code", "country-code", "phone-number"
160+
response = @idtbeyond.post_topup "76560", "amount", "carrier-code", "country-code", "phone-number"
160161
expect(response["success"]).to eq(true)
161162
end
162163
end

0 commit comments

Comments
 (0)