iyzipay-subscriptions 1.0.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.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.travis.yml +17 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE +21 -0
  8. data/README.md +183 -0
  9. data/Rakefile +5 -0
  10. data/VERSION +1 -0
  11. data/contributors +2 -0
  12. data/examples/options.rb +4 -0
  13. data/examples/plan.rb +36 -0
  14. data/examples/product.rb +32 -0
  15. data/examples/subscription.rb +33 -0
  16. data/examples/subscription_checkout_form_initialize.rb +39 -0
  17. data/examples/subscription_initialize.rb +47 -0
  18. data/gemfiles/Gemfile.nokogiri-1.6.8.1 +7 -0
  19. data/iyzipay.gemspec +24 -0
  20. data/lib/iyzipay.rb +16 -0
  21. data/lib/iyzipay/http_client.rb +39 -0
  22. data/lib/iyzipay/iyzipay_resource.rb +60 -0
  23. data/lib/iyzipay/iyzipay_resource_v2.rb +39 -0
  24. data/lib/iyzipay/model.rb +63 -0
  25. data/lib/iyzipay/model/address.rb +17 -0
  26. data/lib/iyzipay/model/api_test.rb +10 -0
  27. data/lib/iyzipay/model/approval.rb +17 -0
  28. data/lib/iyzipay/model/basic_bkm.rb +17 -0
  29. data/lib/iyzipay/model/basic_bkm_initialize.rb +24 -0
  30. data/lib/iyzipay/model/basic_payment.rb +27 -0
  31. data/lib/iyzipay/model/basic_payment_post_auth.rb +20 -0
  32. data/lib/iyzipay/model/basic_payment_pre_auth.rb +27 -0
  33. data/lib/iyzipay/model/basic_threeds_initialize.rb +27 -0
  34. data/lib/iyzipay/model/basic_threeds_initialize_pre_auth.rb +27 -0
  35. data/lib/iyzipay/model/basic_threeds_payment.rb +18 -0
  36. data/lib/iyzipay/model/basket.rb +26 -0
  37. data/lib/iyzipay/model/basket_item_type.rb +8 -0
  38. data/lib/iyzipay/model/bin_number.rb +17 -0
  39. data/lib/iyzipay/model/bkm.rb +17 -0
  40. data/lib/iyzipay/model/bkm_initialize.rb +26 -0
  41. data/lib/iyzipay/model/bounced_bank_transfer_list.rb +17 -0
  42. data/lib/iyzipay/model/buyer.rb +25 -0
  43. data/lib/iyzipay/model/cancel.rb +20 -0
  44. data/lib/iyzipay/model/card.rb +36 -0
  45. data/lib/iyzipay/model/card_information.rb +17 -0
  46. data/lib/iyzipay/model/card_list.rb +17 -0
  47. data/lib/iyzipay/model/checkout_form.rb +17 -0
  48. data/lib/iyzipay/model/checkout_form_initialize.rb +31 -0
  49. data/lib/iyzipay/model/checkout_form_initialize_pre_auth.rb +30 -0
  50. data/lib/iyzipay/model/cross_booking_from_sub_merchant.rb +20 -0
  51. data/lib/iyzipay/model/cross_booking_to_sub_merchant.rb +20 -0
  52. data/lib/iyzipay/model/currency.rb +11 -0
  53. data/lib/iyzipay/model/disapproval.rb +17 -0
  54. data/lib/iyzipay/model/installment_details.rb +19 -0
  55. data/lib/iyzipay/model/installment_info.rb +18 -0
  56. data/lib/iyzipay/model/installment_prices.rb +19 -0
  57. data/lib/iyzipay/model/locale.rb +8 -0
  58. data/lib/iyzipay/model/pay_with_iyzico_initialize.rb +31 -0
  59. data/lib/iyzipay/model/pay_with_iyzico_retrieve.rb +17 -0
  60. data/lib/iyzipay/model/payment.rb +47 -0
  61. data/lib/iyzipay/model/payment_card.rb +22 -0
  62. data/lib/iyzipay/model/payment_channel.rb +14 -0
  63. data/lib/iyzipay/model/payment_group.rb +9 -0
  64. data/lib/iyzipay/model/payment_post_auth.rb +20 -0
  65. data/lib/iyzipay/model/payment_pre_auth.rb +47 -0
  66. data/lib/iyzipay/model/payout_completed_transaction_list.rb +17 -0
  67. data/lib/iyzipay/model/pecco_initialize.rb +27 -0
  68. data/lib/iyzipay/model/pecco_payment.rb +17 -0
  69. data/lib/iyzipay/model/refund.rb +22 -0
  70. data/lib/iyzipay/model/refund_charged_from_merchant.rb +20 -0
  71. data/lib/iyzipay/model/refund_reason.rb +10 -0
  72. data/lib/iyzipay/model/refund_to_balance.rb +18 -0
  73. data/lib/iyzipay/model/settlement_to_balance.rb +19 -0
  74. data/lib/iyzipay/model/sub_merchant.rb +72 -0
  75. data/lib/iyzipay/model/sub_merchant_type.rb +9 -0
  76. data/lib/iyzipay/model/threeds_initialize.rb +32 -0
  77. data/lib/iyzipay/model/threeds_initialize_pre_auth.rb +32 -0
  78. data/lib/iyzipay/model/threeds_payment.rb +34 -0
  79. data/lib/iyzipay/model/v2/checkout_form.rb +20 -0
  80. data/lib/iyzipay/model/v2/checkout_form_initialize.rb +21 -0
  81. data/lib/iyzipay/model/v2/plan.rb +33 -0
  82. data/lib/iyzipay/model/v2/product.rb +39 -0
  83. data/lib/iyzipay/model/v2/subscription.rb +60 -0
  84. data/lib/iyzipay/model/v2/subscription_initialize.rb +21 -0
  85. data/lib/iyzipay/options.rb +7 -0
  86. data/lib/iyzipay/pki_builder.rb +101 -0
  87. data/spec/api_test_spec.rb +28 -0
  88. data/spec/approval_spec.rb +41 -0
  89. data/spec/bin_number_spec.rb +42 -0
  90. data/spec/bkm_spec.rb +91 -0
  91. data/spec/builder.rb +9 -0
  92. data/spec/builder/approval_builder.rb +18 -0
  93. data/spec/builder/card_builder.rb +27 -0
  94. data/spec/builder/checkout_form_builder.rb +75 -0
  95. data/spec/builder/payment_builder.rb +167 -0
  96. data/spec/builder/pecco_initialize_builder.rb +74 -0
  97. data/spec/builder/sub_merchant_builder.rb +91 -0
  98. data/spec/cancel_spec.rb +72 -0
  99. data/spec/card_storage_spec.rb +153 -0
  100. data/spec/checkout_form_spec.rb +113 -0
  101. data/spec/disapproval_spec.rb +47 -0
  102. data/spec/installment_spec.rb +46 -0
  103. data/spec/pay_with_iyzico_spec.rb +109 -0
  104. data/spec/payment_spec.rb +320 -0
  105. data/spec/pecco_spec.rb +116 -0
  106. data/spec/refund_spec.rb +76 -0
  107. data/spec/refund_to_balance_spec.rb +37 -0
  108. data/spec/retrieve_transactions_spec.rb +55 -0
  109. data/spec/settlement_to_balance_spec.rb +40 -0
  110. data/spec/spec_helper.rb +81 -0
  111. data/spec/spec_options.rb +5 -0
  112. data/spec/sub_merchant_spec.rb +227 -0
  113. data/spec/threeds_payment_spec.rb +229 -0
  114. metadata +226 -0
@@ -0,0 +1,72 @@
1
+ module Iyzipay
2
+ module Model
3
+ class SubMerchant < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string_create(request)
7
+ HttpClient.post("#{options.base_url}/onboarding/submerchant", get_http_header(pki_string, options), request.to_json)
8
+ end
9
+
10
+ def update(request = {}, options)
11
+ pki_string = to_pki_string_update(request)
12
+ HttpClient.put("#{options.base_url}/onboarding/submerchant", get_http_header(pki_string, options), request.to_json)
13
+ end
14
+
15
+ def retrieve(request = {}, options)
16
+ pki_string = to_pki_string_retrieve(request)
17
+ HttpClient.post("#{options.base_url}/onboarding/submerchant/detail", get_http_header(pki_string, options), request.to_json)
18
+ end
19
+
20
+ def to_pki_string_create(request)
21
+ PkiBuilder.new.
22
+ append(:locale, request[:locale]).
23
+ append(:conversationId, request[:conversationId]).
24
+ append(:name, request[:name]).
25
+ append(:email, request[:email]).
26
+ append(:gsmNumber, request[:gsmNumber]).
27
+ append(:address, request[:address]).
28
+ append(:iban, request[:iban]).
29
+ append(:taxOffice, request[:taxOffice]).
30
+ append(:contactName, request[:contactName]).
31
+ append(:contactSurname, request[:contactSurname]).
32
+ append(:legalCompanyTitle, request[:legalCompanyTitle]).
33
+ append(:swiftCode, request[:swiftCode]).
34
+ append(:currency, request[:currency]).
35
+ append(:subMerchantExternalId, request[:subMerchantExternalId]).
36
+ append(:identityNumber, request[:identityNumber]).
37
+ append(:taxNumber, request[:taxNumber]).
38
+ append(:subMerchantType, request[:subMerchantType]).
39
+ get_request_string
40
+ end
41
+
42
+ def to_pki_string_update(request)
43
+ PkiBuilder.new.
44
+ append(:locale, request[:locale]).
45
+ append(:conversationId, request[:conversationId]).
46
+ append(:name, request[:name]).
47
+ append(:email, request[:email]).
48
+ append(:gsmNumber, request[:gsmNumber]).
49
+ append(:address, request[:address]).
50
+ append(:iban, request[:iban]).
51
+ append(:taxOffice, request[:taxOffice]).
52
+ append(:contactName, request[:contactName]).
53
+ append(:contactSurname, request[:contactSurname]).
54
+ append(:legalCompanyTitle, request[:legalCompanyTitle]).
55
+ append(:swiftCode, request[:swiftCode]).
56
+ append(:currency, request[:currency]).
57
+ append(:subMerchantKey, request[:subMerchantKey]).
58
+ append(:identityNumber, request[:identityNumber]).
59
+ append(:taxNumber, request[:taxNumber]).
60
+ get_request_string
61
+ end
62
+
63
+ def to_pki_string_retrieve(request)
64
+ PkiBuilder.new.
65
+ append(:locale, request[:locale]).
66
+ append(:conversationId, request[:conversationId]).
67
+ append(:subMerchantExternalId, request[:subMerchantExternalId]).
68
+ get_request_string
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,9 @@
1
+ module Iyzipay
2
+ module Model
3
+ module SubMerchantType
4
+ PERSONAL = 'PERSONAL'
5
+ PRIVATE_COMPANY = 'PRIVATE_COMPANY'
6
+ LIMITED_OR_JOINT_STOCK_COMPANY = 'LIMITED_OR_JOINT_STOCK_COMPANY'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,32 @@
1
+ module Iyzipay
2
+ module Model
3
+ class ThreedsInitialize < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/initialize3ds/ecom", get_http_header(pki_string, options), request.to_json)
8
+ end
9
+
10
+ def to_pki_string(request)
11
+ PkiBuilder.new.append_super(super).
12
+ append_price(:price, request[:price]).
13
+ append_price(:paidPrice, request[:paidPrice]).
14
+ append(:installment, request[:installment]).
15
+ append(:paymentChannel, request[:paymentChannel]).
16
+ append(:basketId, request[:basketId]).
17
+ append(:paymentGroup, request[:paymentGroup]).
18
+ append(:paymentCard, PaymentCard.to_pki_string(request[:paymentCard])).
19
+ append(:buyer, Buyer.to_pki_string(request[:buyer])).
20
+ append(:shippingAddress, Address.to_pki_string(request[:shippingAddress])).
21
+ append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
22
+ append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
23
+ append(:paymentSource, request[:paymentSource]).
24
+ append(:currency, request[:currency]).
25
+ append(:posOrderId, request[:posOrderId]).
26
+ append(:connectorName, request[:connectorName]).
27
+ append(:callbackUrl, request[:callbackUrl]).
28
+ get_request_string
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module Iyzipay
2
+ module Model
3
+ class ThreedsInitializePreAuth < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/initialize3ds/preauth/ecom", get_http_header(pki_string, options), request.to_json)
8
+ end
9
+
10
+ def to_pki_string(request)
11
+ PkiBuilder.new.append_super(super).
12
+ append_price(:price, request[:price]).
13
+ append_price(:paidPrice, request[:paidPrice]).
14
+ append(:installment, request[:installment]).
15
+ append(:paymentChannel, request[:paymentChannel]).
16
+ append(:basketId, request[:basketId]).
17
+ append(:paymentGroup, request[:paymentGroup]).
18
+ append(:paymentCard, PaymentCard.to_pki_string(request[:paymentCard])).
19
+ append(:buyer, Buyer.to_pki_string(request[:buyer])).
20
+ append(:shippingAddress, Address.to_pki_string(request[:shippingAddress])).
21
+ append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
22
+ append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
23
+ append(:paymentSource, request[:paymentSource]).
24
+ append(:currency, request[:currency]).
25
+ append(:posOrderId, request[:posOrderId]).
26
+ append(:connectorName, request[:connectorName]).
27
+ append(:callbackUrl, request[:callbackUrl]).
28
+ get_request_string
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,34 @@
1
+ module Iyzipay
2
+ module Model
3
+ class ThreedsPayment < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string_create(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/auth3ds/ecom", get_http_header(pki_string, options), request.to_json)
8
+ end
9
+
10
+ def retrieve(request = {}, options)
11
+ pki_string = to_pki_string_retrieve(request)
12
+ HttpClient.post("#{options.base_url}/payment/detail", get_http_header(pki_string, options), request.to_json)
13
+ end
14
+
15
+ def to_pki_string_create(request)
16
+ PkiBuilder.new.
17
+ append(:locale, request[:locale]).
18
+ append(:conversationId, request[:conversationId]).
19
+ append(:paymentId, request[:paymentId]).
20
+ append(:conversationData, request[:conversationData]).
21
+ get_request_string
22
+ end
23
+
24
+ def to_pki_string_retrieve(request)
25
+ PkiBuilder.new.
26
+ append(:locale, request[:locale]).
27
+ append(:conversationId, request[:conversationId]).
28
+ append(:paymentId, request[:paymentId]).
29
+ append(:paymentConversationId, request[:paymentConversationId]).
30
+ get_request_string
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,20 @@
1
+ module Iyzipay
2
+ module Model
3
+ module V2
4
+ class CheckoutForm < IyzipayResourceV2
5
+ RESOURCE = '/v2/subscription/checkoutform'
6
+
7
+ def retrieve(request, options)
8
+ header = get_http_header(options, "#{RESOURCE}/#{request[:token]}")
9
+ HttpClient.get_even_on_error(base_url(options, request[:token]), header)
10
+ end
11
+
12
+ private
13
+
14
+ def base_url(options, token)
15
+ "#{options.base_url}#{RESOURCE}/#{token}"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ module Iyzipay
2
+ module Model
3
+ module V2
4
+ class CheckoutFormInitialize < IyzipayResourceV2
5
+ RESOURCE = '/v2/subscription/checkoutform/initialize'
6
+
7
+ def create(request, options)
8
+ data = request.to_json
9
+ header = get_http_header(options, RESOURCE, data)
10
+ HttpClient.post_even_on_error(base_url(options), header, data)
11
+ end
12
+
13
+ private
14
+
15
+ def base_url(options)
16
+ "#{options.base_url}#{RESOURCE}"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,33 @@
1
+ module Iyzipay
2
+ module Model
3
+ module V2
4
+ class Plan < IyzipayResourceV2
5
+ RESOURCE = '/v2/subscription'
6
+
7
+ def create(request, options)
8
+ path = path_for_action('products', request[:productReferenceCode], 'pricing-plans')
9
+ data = request.to_json
10
+ header = get_http_header(options, path, data)
11
+ HttpClient.post_even_on_error(base_url(options, path), header, data)
12
+ end
13
+
14
+ def update(request, options)
15
+ path = path_for_action('pricing-plans', request[:pricingPlanReferenceCode])
16
+ data = request.to_json
17
+ header = get_http_header(options, path, data)
18
+ HttpClient.post_even_on_error(base_url(options, path), header, data)
19
+ end
20
+
21
+ private
22
+
23
+ def base_url(options, path)
24
+ "#{options.base_url}#{path}"
25
+ end
26
+
27
+ def path_for_action(*args)
28
+ "#{RESOURCE}#{'/' + args.join('/')}"
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Iyzipay
4
+ module Model
5
+ module V2
6
+ class Product < IyzipayResourceV2
7
+ RESOURCE = '/v2/subscription/products'
8
+
9
+ def list(options)
10
+ header = get_http_header(options, RESOURCE)
11
+ HttpClient.get_even_on_error(base_url(options), header)
12
+ end
13
+
14
+ def create(request, options)
15
+ data = request.to_json
16
+ header = get_http_header(options, RESOURCE, data)
17
+ HttpClient.post_even_on_error(base_url(options), header, data)
18
+ end
19
+
20
+ def update(request, options)
21
+ data = request.to_json
22
+ path = path_for_action(request[:productReferenceCode])
23
+ header = get_http_header(options, path, data)
24
+ HttpClient.post_even_on_error(base_url(options, path), header, data)
25
+ end
26
+
27
+ private
28
+
29
+ def base_url(options, path = RESOURCE)
30
+ "#{options.base_url}#{path}"
31
+ end
32
+
33
+ def path_for_action(*path_args)
34
+ "#{RESOURCE}#{'/' + path_args.join('/')}"
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,60 @@
1
+ module Iyzipay
2
+ module Model
3
+ module V2
4
+ class Subscription < IyzipayResourceV2
5
+ RESOURCE = '/v2/subscription'
6
+ def activate(request, options)
7
+ path = path_for_action(request[:subscriptionReferenceCode], 'subscriptions/activate')
8
+ data = request.to_json
9
+ header = get_http_header(options, path, data)
10
+ HttpClient.post_even_on_error(base_url(options, path), header, data)
11
+ end
12
+
13
+ def retry(request, options)
14
+ path = path_for_action('operation/retry')
15
+ data = request.to_json
16
+ header = get_http_header(options, path, data)
17
+ HttpClient.post_even_on_error(base_url(options, path), header, data)
18
+ end
19
+
20
+ def upgrade(request, options)
21
+ path = path_for_action('subscriptions', request[:subscriptionReferenceCode], 'upgrade')
22
+ data = request.to_json
23
+ header = get_http_header(options, path, data)
24
+ HttpClient.post_even_on_error(base_url(options, path), header, data)
25
+ end
26
+
27
+ def cancel(request, options)
28
+ path = path_for_action('subscriptions', request[:subscriptionReferenceCode], 'cancel')
29
+ data = request.to_json
30
+ header = get_http_header(options, path, data)
31
+ HttpClient.post_even_on_error(base_url(options, path), header, data)
32
+ end
33
+
34
+ def details(request, options)
35
+ path = path_for_action('subscriptions', request[:subscriptionReferenceCode])
36
+ data = request.to_json
37
+ header = get_http_header(options, path, data)
38
+ HttpClient.post_even_on_error(base_url(options, path), header, data)
39
+ end
40
+
41
+ def search(request, options)
42
+ data = request.to_json
43
+ path = path_for_action('subscriptions')
44
+ header = get_http_header(options, path, data)
45
+ HttpClient.get_even_on_error(base_url(options, RESOURCE), header)
46
+ end
47
+
48
+ private
49
+
50
+ def base_url(options, path = nil)
51
+ "#{options.base_url}#{path}"
52
+ end
53
+
54
+ def path_for_action(*args)
55
+ "#{RESOURCE}#{'/' + args.join('/')}"
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,21 @@
1
+ module Iyzipay
2
+ module Model
3
+ module V2
4
+ class SubscriptionInitialize < IyzipayResourceV2
5
+ RESOURCE = '/v2/subscription/initialize'
6
+
7
+ def create(request, options)
8
+ data = request.to_json
9
+ header = get_http_header(options, RESOURCE, data)
10
+ HttpClient.post_even_on_error(base_url(options), header, data)
11
+ end
12
+
13
+ private
14
+
15
+ def base_url(options)
16
+ "#{options.base_url}#{RESOURCE}"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ module Iyzipay
2
+ class Options
3
+ attr_accessor :api_key
4
+ attr_accessor :secret_key
5
+ attr_accessor :base_url
6
+ end
7
+ end
@@ -0,0 +1,101 @@
1
+ module Iyzipay
2
+ class PkiBuilder
3
+ attr_accessor :request_string
4
+
5
+ def initialize(request_string = '')
6
+ @request_string = request_string
7
+ end
8
+
9
+ def append_super(super_request_string)
10
+ unless super_request_string.nil?
11
+
12
+ s = super_request_string[1..-2]
13
+ if s.length > 0
14
+ result = @request_string + s
15
+ result << ','
16
+ end
17
+ @request_string = result
18
+ end
19
+ self
20
+ end
21
+
22
+ def append(key, value = nil)
23
+ unless value.nil?
24
+ append_key_value(key, value)
25
+ end
26
+ self
27
+ end
28
+
29
+ def append_price(key, value = nil)
30
+ unless value.nil?
31
+ append_key_value(key, format_price(value))
32
+ end
33
+ self
34
+ end
35
+
36
+ def append_array(key, array = nil)
37
+ unless array.nil?
38
+ appended_value = ''
39
+ array.each do |value|
40
+ appended_value << value.to_s
41
+ appended_value << ', '
42
+ end
43
+ end
44
+ append_key_value_array(key, appended_value)
45
+
46
+ self
47
+ end
48
+
49
+ def append_key_value(key, value)
50
+ @request_string = "#{@request_string}#{key}=#{value}," unless value.nil?
51
+ end
52
+
53
+ def append_key_value_array(key, value)
54
+ unless value.nil?
55
+ sub = ', '
56
+ value = value.gsub(/[#{sub}]+$/, '')
57
+ @request_string = "#{@request_string}#{key}=[#{value}],"
58
+ end
59
+
60
+ self
61
+ end
62
+
63
+ def append_prefix
64
+ @request_string = "[#{@request_string}]"
65
+ end
66
+
67
+ def remove_trailing_comma
68
+ sub = ','
69
+ @request_string = @request_string.gsub(/[#{sub}]+$/, '')
70
+ end
71
+
72
+ def get_request_string
73
+ remove_trailing_comma
74
+ append_prefix
75
+
76
+ @request_string
77
+ end
78
+
79
+ def format_price(price)
80
+ unless price.include? '.'
81
+ price = price+'.0'
82
+ end
83
+ sub_str_index = 0
84
+ price_reversed = price.reverse
85
+ i=0
86
+ while i < price.size do
87
+ if price_reversed[i] == '0'
88
+ sub_str_index = i + 1
89
+ elsif price_reversed[i] == '.'
90
+ price_reversed = '0' + price_reversed
91
+ break
92
+ else
93
+ break
94
+ end
95
+ i+=1
96
+ end
97
+ (price_reversed[sub_str_index..-1]).reverse
98
+ end
99
+
100
+ end
101
+ end