iyzipay 1.0.29

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 (84) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +14 -0
  7. data/Gemfile +8 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +3 -0
  10. data/Rakefile +5 -0
  11. data/VERSION +1 -0
  12. data/contributors +2 -0
  13. data/iyzipay.gemspec +24 -0
  14. data/lib/Iyzipay.rb +16 -0
  15. data/lib/iyzipay/http_client.rb +19 -0
  16. data/lib/iyzipay/iyzipay_resource.rb +59 -0
  17. data/lib/iyzipay/model.rb +43 -0
  18. data/lib/iyzipay/model/address.rb +17 -0
  19. data/lib/iyzipay/model/approval.rb +17 -0
  20. data/lib/iyzipay/model/basic_bkm.rb +17 -0
  21. data/lib/iyzipay/model/basic_bkm_initialize.rb +24 -0
  22. data/lib/iyzipay/model/basic_payment.rb +26 -0
  23. data/lib/iyzipay/model/basic_payment_post_auth.rb +19 -0
  24. data/lib/iyzipay/model/basic_payment_pre_auth.rb +26 -0
  25. data/lib/iyzipay/model/basic_threeds_initialize.rb +26 -0
  26. data/lib/iyzipay/model/basic_threeds_initialize_pre_auth.rb +26 -0
  27. data/lib/iyzipay/model/basic_threeds_payment.rb +18 -0
  28. data/lib/iyzipay/model/basket.rb +26 -0
  29. data/lib/iyzipay/model/basket_item_type.rb +8 -0
  30. data/lib/iyzipay/model/bin_number.rb +17 -0
  31. data/lib/iyzipay/model/bkm.rb +17 -0
  32. data/lib/iyzipay/model/bkm_initialize.rb +24 -0
  33. data/lib/iyzipay/model/bounced_bank_transfer_list.rb +17 -0
  34. data/lib/iyzipay/model/buyer.rb +25 -0
  35. data/lib/iyzipay/model/cancel.rb +18 -0
  36. data/lib/iyzipay/model/checkout_form.rb +17 -0
  37. data/lib/iyzipay/model/checkout_form_initialize.rb +29 -0
  38. data/lib/iyzipay/model/checkout_form_initialize_pre_auth.rb +29 -0
  39. data/lib/iyzipay/model/cross_booking_from_sub_merchant.rb +19 -0
  40. data/lib/iyzipay/model/cross_booking_to_sub_merchant.rb +19 -0
  41. data/lib/iyzipay/model/disapproval.rb +17 -0
  42. data/lib/iyzipay/model/installment_details.rb +19 -0
  43. data/lib/iyzipay/model/installment_info.rb +18 -0
  44. data/lib/iyzipay/model/installment_prices.rb +19 -0
  45. data/lib/iyzipay/model/payment.rb +28 -0
  46. data/lib/iyzipay/model/payment_card.rb +22 -0
  47. data/lib/iyzipay/model/payment_channel.rb +14 -0
  48. data/lib/iyzipay/model/payment_group.rb +9 -0
  49. data/lib/iyzipay/model/payment_post_auth.rb +19 -0
  50. data/lib/iyzipay/model/payment_pre_auth.rb +44 -0
  51. data/lib/iyzipay/model/payout_completed_transaction_list.rb +17 -0
  52. data/lib/iyzipay/model/refund.rb +19 -0
  53. data/lib/iyzipay/model/refund_charged_from_merchant.rb +19 -0
  54. data/lib/iyzipay/model/sub_merchant.rb +68 -0
  55. data/lib/iyzipay/model/sub_merchant_type.rb +9 -0
  56. data/lib/iyzipay/model/threeds_initialize.rb +28 -0
  57. data/lib/iyzipay/model/threeds_initialize_pre_auth.rb +31 -0
  58. data/lib/iyzipay/model/threeds_payment.rb +34 -0
  59. data/lib/iyzipay/options.rb +7 -0
  60. data/lib/iyzipay/pki_builder.rb +101 -0
  61. data/lib/iyzipay/version.rb +3 -0
  62. data/spec/approval_spec.rb +45 -0
  63. data/spec/basic_bkm_spec.rb +261 -0
  64. data/spec/basic_payment_post_auth_spec.rb +32 -0
  65. data/spec/basic_payment_pre_auth_spec.rb +71 -0
  66. data/spec/basic_payment_spec.rb +71 -0
  67. data/spec/basic_threeds_pre_auth_spec.rb +85 -0
  68. data/spec/basic_threeds_spec.rb +101 -0
  69. data/spec/bin_number_spec.rb +30 -0
  70. data/spec/bkm_spec.rb +111 -0
  71. data/spec/cancel_spec.rb +31 -0
  72. data/spec/checkout_form_pre_auth_spec.rb +92 -0
  73. data/spec/checkout_form_spec.rb +107 -0
  74. data/spec/cross_booking_spec.rb +49 -0
  75. data/spec/installment_spec.rb +31 -0
  76. data/spec/payment_post_auth_spec.rb +32 -0
  77. data/spec/payment_pre_auth_spec.rb +117 -0
  78. data/spec/payment_spec.rb +101 -0
  79. data/spec/refund_spec.rb +49 -0
  80. data/spec/retrieve_transactions_spec.rb +45 -0
  81. data/spec/spec_helper.rb +80 -0
  82. data/spec/sub_merchant_spec.rb +174 -0
  83. data/spec/threeds_pre_auth_spec.rb +139 -0
  84. metadata +185 -0
@@ -0,0 +1,26 @@
1
+ module Iyzipay
2
+ module Model
3
+ class BasicThreedsInitializePreAuth < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyziconnect/initialize3ds/preauth", 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(:buyerEmail, request[:buyerEmail]).
16
+ append(:buyerId, request[:buyerId]).
17
+ append(:buyerIp, request[:buyerIp]).
18
+ append(:posOrderId, request[:posOrderId]).
19
+ append(:paymentCard, PaymentCard.to_pki_string(request[:paymentCard])).
20
+ append(:connectorName, request[:connectorName]).
21
+ append(:callbackUrl, request[:callbackUrl]).
22
+ get_request_string
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ module Iyzipay
2
+ module Model
3
+ class BasicThreedsPayment < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyziconnect/auth3ds", 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(:paymentId, request[:paymentId]).
13
+ append(:conversationData, request[:conversationData]).
14
+ get_request_string
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ module Iyzipay
2
+ module Model
3
+ class Basket
4
+ def self.to_pki_string(request)
5
+ unless request.nil?
6
+ basket_items = Array.new
7
+ request.each do |item|
8
+ item_pki = PkiBuilder.new.
9
+ append(:id, item[:id]).
10
+ append_price(:price, item[:price]).
11
+ append(:name, item[:name]).
12
+ append(:category1, item[:category1]).
13
+ append(:category2, item[:category2]).
14
+ append(:itemType, item[:itemType]).
15
+ append(:subMerchantKey, item[:subMerchantKey]).
16
+ append_price(:subMerchantPrice, item[:subMerchantPrice]).
17
+ append(:ip, item[:ip]).
18
+ get_request_string
19
+ basket_items << item_pki
20
+ end
21
+ basket_items
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,8 @@
1
+ module Iyzipay
2
+ module Model
3
+ module BasketItemType
4
+ PHYSICAL = 'PHYSICAL'
5
+ VIRTUAL = 'VIRTUAL'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ module Iyzipay
2
+ module Model
3
+ class BinNumber < IyzipayResource
4
+
5
+ def retrieve(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/bin/check", 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(:binNumber, request[:binNumber]).
13
+ get_request_string
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Iyzipay
2
+ module Model
3
+ class Bkm < IyzipayResource
4
+
5
+ def retrieve(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/bkm/auth/ecom/detail", 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(:token, request[:token]).
13
+ get_request_string
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ module Iyzipay
2
+ module Model
3
+ class BkmInitialize < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/bkm/initialize/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(:basketId, request[:basketId]).
14
+ append(:paymentGroup, request[:paymentGroup]).
15
+ append(:buyer, Buyer.to_pki_string(request[:buyer])).
16
+ append(:shippingAddress, Address.to_pki_string(request[:shippingAddress])).
17
+ append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
18
+ append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
19
+ append(:callbackUrl, request[:callbackUrl]).
20
+ get_request_string
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ module Iyzipay
2
+ module Model
3
+ class BouncedBankTransferList < IyzipayResource
4
+
5
+ def retrieve(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/reporting/settlement/bounced", 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(:date, request[:date]).
13
+ get_request_string
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ module Iyzipay
2
+ module Model
3
+ class Buyer
4
+ def self.to_pki_string(request)
5
+ unless request.nil?
6
+ PkiBuilder.new.
7
+ append(:id, request[:id]).
8
+ append(:name, request[:name]).
9
+ append(:surname, request[:surname]).
10
+ append(:identityNumber, request[:identityNumber]).
11
+ append(:email, request[:email]).
12
+ append(:gsmNumber, request[:gsmNumber]).
13
+ append(:registrationDate, request[:registrationDate]).
14
+ append(:lastLoginDate, request[:lastLoginDate]).
15
+ append(:registrationAddress, request[:registrationAddress]).
16
+ append(:city, request[:city]).
17
+ append(:country, request[:country]).
18
+ append(:zipCode, request[:zipCode]).
19
+ append(:ip, request[:ip]).
20
+ get_request_string
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,18 @@
1
+ module Iyzipay
2
+ module Model
3
+ class Cancel < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/cancel", 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(:paymentId, request[:paymentId]).
13
+ append(:ip, request[:ip]).
14
+ get_request_string
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ module Iyzipay
2
+ module Model
3
+ class CheckoutForm < IyzipayResource
4
+
5
+ def retrieve(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/checkoutform/auth/ecom/detail", 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(:token, request[:token]).
13
+ get_request_string
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,29 @@
1
+ module Iyzipay
2
+ module Model
3
+ class CheckoutFormInitialize < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/checkoutform/initialize/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(:basketId, request[:basketId]).
14
+ append(:paymentGroup, request[:paymentGroup]).
15
+ append(:buyer, Buyer.to_pki_string(request[:buyer])).
16
+ append(:shippingAddress, Address.to_pki_string(request[:shippingAddress])).
17
+ append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
18
+ append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
19
+ append(:callbackUrl, request[:callbackUrl]).
20
+ append(:paymentSource, request[:paymentSource]).
21
+ append(:posOrderId, request[:posOrderId]).
22
+ append_price(:paidPrice, request[:paidPrice]).
23
+ append(:forceThreeDS, request[:forceThreeDS]).
24
+ append(:cardUserKey, request[:cardUserKey]).
25
+ get_request_string
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module Iyzipay
2
+ module Model
3
+ class CheckoutFormInitializePreAuth < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/checkoutform/initialize/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(:basketId, request[:basketId]).
14
+ append(:paymentGroup, request[:paymentGroup]).
15
+ append(:buyer, Buyer.to_pki_string(request[:buyer])).
16
+ append(:shippingAddress, Address.to_pki_string(request[:shippingAddress])).
17
+ append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
18
+ append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
19
+ append(:callbackUrl, request[:callbackUrl]).
20
+ append(:paymentSource, request[:paymentSource]).
21
+ append(:posOrderId, request[:posOrderId]).
22
+ append_price(:paidPrice, request[:paidPrice]).
23
+ append(:forceThreeDS, request[:forceThreeDS]).
24
+ append(:cardUserKey, request[:cardUserKey]).
25
+ get_request_string
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,19 @@
1
+ module Iyzipay
2
+ module Model
3
+ class CrossBookingFromSubMerchant < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/crossbooking/receive", 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(:subMerchantKey, request[:subMerchantKey]).
13
+ append_price(:price, request[:price]).
14
+ append(:reason, request[:reason]).
15
+ get_request_string
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Iyzipay
2
+ module Model
3
+ class CrossBookingToSubMerchant < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/crossbooking/send", 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(:subMerchantKey, request[:subMerchantKey]).
13
+ append_price(:price, request[:price]).
14
+ append(:reason, request[:reason]).
15
+ get_request_string
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ module Iyzipay
2
+ module Model
3
+ class Disapproval < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/item/disapprove", 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(:paymentTransactionId, request[:paymentTransactionId]).
13
+ get_request_string
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module Iyzipay
2
+ module Model
3
+ class InstallmentDetails
4
+ def self.to_pki_string(request)
5
+ unless request.nil?
6
+ installment_details = Array.new
7
+ request.each do |item|
8
+ item_pki = PkiBuilder.new.
9
+ append(:bankId, item[:bankId]).
10
+ append_array(:installmentPrices, InstallmentPrices.to_pki_string(item[:installmentPrices])).
11
+ get_request_string
12
+ installment_details << item_pki
13
+ end
14
+ installment_details
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module Iyzipay
2
+ module Model
3
+ class InstallmentInfo < IyzipayResource
4
+
5
+ def retrieve(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/installment", 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(:binNumber, request[:binNumber]).
13
+ append_price(:price, request[:price]).
14
+ get_request_string
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ module Iyzipay
2
+ module Model
3
+ class InstallmentPrices
4
+ def self.to_pki_string(request)
5
+ unless request.nil?
6
+ installment_prices = Array.new
7
+ request.each do |item|
8
+ item_pki = PkiBuilder.new.
9
+ append(:installmentNumber, item[:installmentNumber]).
10
+ append_price(:totalPrice, item[:totalPrice]).
11
+ get_request_string
12
+ installment_prices << item_pki
13
+ end
14
+ installment_prices
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,28 @@
1
+ module Iyzipay
2
+ module Model
3
+ class Payment < IyzipayResource
4
+
5
+ def create(request = {}, options)
6
+ pki_string = to_pki_string(request)
7
+ HttpClient.post("#{options.base_url}/payment/iyzipos/auth/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
+ get_request_string
25
+ end
26
+ end
27
+ end
28
+ end