hypercharge-schema 1.24.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.travis.yml +6 -0
  4. data/CHANGELOG.md +3 -0
  5. data/Gemfile +7 -0
  6. data/Gemfile.lock +33 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +73 -0
  9. data/Rakefile +14 -0
  10. data/composer.json +17 -0
  11. data/hypercharge-schema.gemspec +27 -0
  12. data/json/MobilePayment.json +73 -0
  13. data/json/WpfPayment.json +99 -0
  14. data/json/authorize.json +77 -0
  15. data/json/authorize3d.json +173 -0
  16. data/json/capture.json +42 -0
  17. data/json/debit_sale.json +73 -0
  18. data/json/direct_pay24_sale.json +85 -0
  19. data/json/giro_pay_sale.json +85 -0
  20. data/json/ideal_sale.json +87 -0
  21. data/json/init_recurring_authorize.json +81 -0
  22. data/json/init_recurring_debit_authorize.json +77 -0
  23. data/json/init_recurring_debit_sale.json +77 -0
  24. data/json/init_recurring_sale.json +81 -0
  25. data/json/pay_in_advance.json +61 -0
  26. data/json/pay_pal.json +65 -0
  27. data/json/pay_safe_card_sale.json +69 -0
  28. data/json/payment_on_delivery.json +57 -0
  29. data/json/purchase_on_account.json +61 -0
  30. data/json/reconcile.json +20 -0
  31. data/json/recurring_debit_sale.json +45 -0
  32. data/json/recurring_sale.json +45 -0
  33. data/json/referenced_fund_transfer.json +46 -0
  34. data/json/refund.json +42 -0
  35. data/json/sale.json +77 -0
  36. data/json/sale3d.json +173 -0
  37. data/json/scheduler_create.json +46 -0
  38. data/json/scheduler_index.json +34 -0
  39. data/json/scheduler_update.json +35 -0
  40. data/json/types.json +385 -0
  41. data/json/void.json +33 -0
  42. data/lib/php/JsonSchemaFixture.php +12 -0
  43. data/lib/php/JsonSchemaValidator.php +47 -0
  44. data/lib/ruby/hypercharge/schema.rb +31 -0
  45. data/lib/ruby/hypercharge/schema/fixture.rb +30 -0
  46. data/lib/ruby/hypercharge/schema/version.rb +7 -0
  47. data/package.json +27 -0
  48. data/test/fixtures/notifications/PaymentNotification_echo.xml +4 -0
  49. data/test/fixtures/notifications/TransactionNotification_echo.xml +4 -0
  50. data/test/fixtures/notifications/recurring_event.json +13 -0
  51. data/test/fixtures/notifications/scheduler.json +7 -0
  52. data/test/fixtures/requests/MobilePayment.json +35 -0
  53. data/test/fixtures/requests/MobilePayment.xml +34 -0
  54. data/test/fixtures/requests/WpfPayment.json +40 -0
  55. data/test/fixtures/requests/WpfPayment.xml +39 -0
  56. data/test/fixtures/requests/WpfPayment_cancel.xml +4 -0
  57. data/test/fixtures/requests/WpfPayment_capture.xml +4 -0
  58. data/test/fixtures/requests/WpfPayment_refund.xml +4 -0
  59. data/test/fixtures/requests/WpfPayment_void.xml +4 -0
  60. data/test/fixtures/requests/authorize.json +29 -0
  61. data/test/fixtures/requests/authorize.xml +28 -0
  62. data/test/fixtures/requests/authorize3d_async.json +32 -0
  63. data/test/fixtures/requests/authorize3d_async.xml +31 -0
  64. data/test/fixtures/requests/authorize3d_sync.json +34 -0
  65. data/test/fixtures/requests/authorize3d_sync.xml +33 -0
  66. data/test/fixtures/requests/capture.json +10 -0
  67. data/test/fixtures/requests/capture.xml +9 -0
  68. data/test/fixtures/requests/debit_sale.json +28 -0
  69. data/test/fixtures/requests/debit_sale.xml +27 -0
  70. data/test/fixtures/requests/direct_pay24_sale.json +31 -0
  71. data/test/fixtures/requests/direct_pay24_sale.xml +30 -0
  72. data/test/fixtures/requests/giro_pay_sale.json +31 -0
  73. data/test/fixtures/requests/giro_pay_sale.xml +30 -0
  74. data/test/fixtures/requests/ideal_sale.json +31 -0
  75. data/test/fixtures/requests/ideal_sale.xml +30 -0
  76. data/test/fixtures/requests/init_recurring_authorize.json +34 -0
  77. data/test/fixtures/requests/init_recurring_authorize.xml +33 -0
  78. data/test/fixtures/requests/init_recurring_debit_authorize.json +33 -0
  79. data/test/fixtures/requests/init_recurring_debit_authorize.xml +32 -0
  80. data/test/fixtures/requests/init_recurring_debit_sale.json +34 -0
  81. data/test/fixtures/requests/init_recurring_debit_sale.xml +32 -0
  82. data/test/fixtures/requests/init_recurring_sale.json +34 -0
  83. data/test/fixtures/requests/init_recurring_sale.xml +33 -0
  84. data/test/fixtures/requests/init_recurring_sale_with_recurring_schedule.json +34 -0
  85. data/test/fixtures/requests/pay_in_advance.json +24 -0
  86. data/test/fixtures/requests/pay_in_advance.xml +23 -0
  87. data/test/fixtures/requests/pay_pal.json +23 -0
  88. data/test/fixtures/requests/pay_pal.xml +22 -0
  89. data/test/fixtures/requests/pay_safe_card_sale.json +23 -0
  90. data/test/fixtures/requests/pay_safe_card_sale.xml +23 -0
  91. data/test/fixtures/requests/payment_on_delivery.json +24 -0
  92. data/test/fixtures/requests/payment_on_delivery.xml +23 -0
  93. data/test/fixtures/requests/purchase_on_account.json +26 -0
  94. data/test/fixtures/requests/purchase_on_account.xml +23 -0
  95. data/test/fixtures/requests/reconcile.json +5 -0
  96. data/test/fixtures/requests/reconcile.xml +4 -0
  97. data/test/fixtures/requests/reconcile_by_date.json +7 -0
  98. data/test/fixtures/requests/reconcile_by_date.xml +6 -0
  99. data/test/fixtures/requests/recurring_debit_sale.json +11 -0
  100. data/test/fixtures/requests/recurring_debit_sale.xml +10 -0
  101. data/test/fixtures/requests/recurring_event.xml +4 -0
  102. data/test/fixtures/requests/recurring_sale.json +11 -0
  103. data/test/fixtures/requests/recurring_sale.xml +10 -0
  104. data/test/fixtures/requests/referenced_fund_transfer.json +11 -0
  105. data/test/fixtures/requests/referenced_fund_transfer.xml +10 -0
  106. data/test/fixtures/requests/refund.json +10 -0
  107. data/test/fixtures/requests/refund.xml +9 -0
  108. data/test/fixtures/requests/risk_params.json +10 -0
  109. data/test/fixtures/requests/risk_params.xml +9 -0
  110. data/test/fixtures/requests/sale.json +29 -0
  111. data/test/fixtures/requests/sale.xml +28 -0
  112. data/test/fixtures/requests/sale3d_async.json +32 -0
  113. data/test/fixtures/requests/sale3d_async.xml +31 -0
  114. data/test/fixtures/requests/sale3d_sync.json +34 -0
  115. data/test/fixtures/requests/sale3d_sync.xml +33 -0
  116. data/test/fixtures/requests/scheduler_create.json +9 -0
  117. data/test/fixtures/requests/scheduler_index_get_params.json +9 -0
  118. data/test/fixtures/requests/scheduler_update.json +8 -0
  119. data/test/fixtures/requests/void.json +8 -0
  120. data/test/fixtures/requests/void.xml +7 -0
  121. data/test/fixtures/responses/MobilePayment_new.json +20 -0
  122. data/test/fixtures/responses/MobilePayment_new.xml +19 -0
  123. data/test/fixtures/responses/PaymentNotification_echo.xml +4 -0
  124. data/test/fixtures/responses/PaymentTransactionNotification_echo.xml +4 -0
  125. data/test/fixtures/responses/WpfPayment_cancel.xml +13 -0
  126. data/test/fixtures/responses/WpfPayment_captured.xml +39 -0
  127. data/test/fixtures/responses/WpfPayment_error.json +8 -0
  128. data/test/fixtures/responses/WpfPayment_error.xml +7 -0
  129. data/test/fixtures/responses/WpfPayment_find.xml +39 -0
  130. data/test/fixtures/responses/WpfPayment_new.json +16 -0
  131. data/test/fixtures/responses/WpfPayment_new.xml +17 -0
  132. data/test/fixtures/responses/WpfPayment_refunded.xml +39 -0
  133. data/test/fixtures/responses/WpfPayment_voided.xml +39 -0
  134. data/test/fixtures/responses/authorize3d_pending_async.xml +15 -0
  135. data/test/fixtures/responses/authorize3d_sync.xml +14 -0
  136. data/test/fixtures/responses/authorize_approved.xml +14 -0
  137. data/test/fixtures/responses/authorize_error.json +16 -0
  138. data/test/fixtures/responses/authorize_error.xml +15 -0
  139. data/test/fixtures/responses/capture.xml +14 -0
  140. data/test/fixtures/responses/create_chargeback.xml +12 -0
  141. data/test/fixtures/responses/create_chargeback_reversal.xml +12 -0
  142. data/test/fixtures/responses/create_charged_debit_sale.xml +12 -0
  143. data/test/fixtures/responses/create_debit_chargeback.xml +12 -0
  144. data/test/fixtures/responses/create_deposit.xml +12 -0
  145. data/test/fixtures/responses/create_pre_arbitration.xml +12 -0
  146. data/test/fixtures/responses/create_rejected_debit_sale.xml +12 -0
  147. data/test/fixtures/responses/create_retrieval_request.xml +12 -0
  148. data/test/fixtures/responses/debit_sale.xml +12 -0
  149. data/test/fixtures/responses/direct_pay24_sale.xml +15 -0
  150. data/test/fixtures/responses/giro_pay_sale.xml +15 -0
  151. data/test/fixtures/responses/ideal_sale.xml +17 -0
  152. data/test/fixtures/responses/init_recurring_authorize.xml +14 -0
  153. data/test/fixtures/responses/init_recurring_debit_authorize.xml +17 -0
  154. data/test/fixtures/responses/init_recurring_debit_sale.xml +17 -0
  155. data/test/fixtures/responses/init_recurring_sale.xml +14 -0
  156. data/test/fixtures/responses/pay_in_advance.xml +17 -0
  157. data/test/fixtures/responses/pay_pal.xml +15 -0
  158. data/test/fixtures/responses/pay_safe_card_sale.xml +15 -0
  159. data/test/fixtures/responses/payment_on_delivery.xml +14 -0
  160. data/test/fixtures/responses/purchase_on_account.xml +18 -0
  161. data/test/fixtures/responses/reconcile_by_date_empty_result.xml +3 -0
  162. data/test/fixtures/responses/reconcile_by_date_page_1.xml +1293 -0
  163. data/test/fixtures/responses/reconcile_by_date_page_2.xml +1346 -0
  164. data/test/fixtures/responses/reconcile_by_date_page_3.xml +1394 -0
  165. data/test/fixtures/responses/reconcile_by_date_single_result.xml +16 -0
  166. data/test/fixtures/responses/recurring_debit_sale.xml +16 -0
  167. data/test/fixtures/responses/recurring_event.json +22 -0
  168. data/test/fixtures/responses/recurring_event.xml +21 -0
  169. data/test/fixtures/responses/recurring_sale.xml +14 -0
  170. data/test/fixtures/responses/referenced_fund_transfer.xml +14 -0
  171. data/test/fixtures/responses/refund.xml +14 -0
  172. data/test/fixtures/responses/sale.xml +12 -0
  173. data/test/fixtures/responses/sale3d_async.xml +15 -0
  174. data/test/fixtures/responses/sale3d_sync.xml +14 -0
  175. data/test/fixtures/responses/scheduled_transactions_empty.json +8 -0
  176. data/test/fixtures/responses/scheduled_transactions_one.json +22 -0
  177. data/test/fixtures/responses/scheduler.json +12 -0
  178. data/test/fixtures/responses/scheduler_empty_result.json +8 -0
  179. data/test/fixtures/responses/scheduler_error.json +7 -0
  180. data/test/fixtures/responses/scheduler_next.json +4 -0
  181. data/test/fixtures/responses/scheduler_page_1.json +93 -0
  182. data/test/fixtures/responses/scheduler_page_2.json +45 -0
  183. data/test/fixtures/responses/scheduler_single_result.json +21 -0
  184. data/test/fixtures/responses/void.xml +12 -0
  185. data/test/js/mobile_payment_test.js +287 -0
  186. data/test/php/all.php +9 -0
  187. data/test/php/authorize3d_test.php +546 -0
  188. data/test/php/authorize_test.php +546 -0
  189. data/test/php/capture_test.php +241 -0
  190. data/test/php/json_schema_validator_test.php +24 -0
  191. data/test/php/mobile_payment_test.php +238 -0
  192. data/test/php/reconcile_test.php +21 -0
  193. data/test/php/referenced_fund_transfer_test.php +183 -0
  194. data/test/php/refund_test.php +237 -0
  195. data/test/php/sale_test.php +546 -0
  196. data/test/php/test_helper.php +29 -0
  197. data/test/php/void_test.php +163 -0
  198. data/test/php/wpf_payment_test.php +19 -0
  199. data/test/ruby/authorize3d_async_spec.rb +29 -0
  200. data/test/ruby/authorize3d_sync_spec.rb +27 -0
  201. data/test/ruby/authorize_spec.rb +25 -0
  202. data/test/ruby/capture_spec.rb +16 -0
  203. data/test/ruby/debit_sale_spec.rb +26 -0
  204. data/test/ruby/direct_pay24_sale_spec.rb +30 -0
  205. data/test/ruby/giro_pay_sale_spec.rb +30 -0
  206. data/test/ruby/ideal_sale_spec.rb +29 -0
  207. data/test/ruby/init_recurring_authorize_spec.rb +26 -0
  208. data/test/ruby/init_recurring_debit_authorize_spec.rb +27 -0
  209. data/test/ruby/init_recurring_debit_sale_spec.rb +27 -0
  210. data/test/ruby/init_recurring_sale_spec.rb +26 -0
  211. data/test/ruby/mobile_payment_spec.rb +22 -0
  212. data/test/ruby/pay_in_advance_spec.rb +23 -0
  213. data/test/ruby/pay_pal_spec.rb +25 -0
  214. data/test/ruby/pay_safe_card_sale_spec.rb +24 -0
  215. data/test/ruby/payment_on_delivery_spec.rb +21 -0
  216. data/test/ruby/purchase_on_account_spec.rb +23 -0
  217. data/test/ruby/reconcile_spec.rb +11 -0
  218. data/test/ruby/recurring_debit_sale_spec.rb +17 -0
  219. data/test/ruby/recurring_sale_spec.rb +17 -0
  220. data/test/ruby/referenced_fund_transfer_spec.rb +17 -0
  221. data/test/ruby/refund_spec.rb +16 -0
  222. data/test/ruby/sale3d_async_spec.rb +29 -0
  223. data/test/ruby/sale3d_sync_spec.rb +27 -0
  224. data/test/ruby/sale_spec.rb +25 -0
  225. data/test/ruby/scheduler_spec.rb +43 -0
  226. data/test/ruby/test_helper.rb +74 -0
  227. data/test/ruby/types_specs.rb +1494 -0
  228. data/test/ruby/void_spec.rb +14 -0
  229. data/test/ruby/wpf_payment_spec.rb +27 -0
  230. metadata +527 -0
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payment_responses per_page="100" total_count="1" page="1" pages_count="1">
3
+ <payment_response>
4
+ <transaction_type>authorize</transaction_type>
5
+ <status>approved</status>
6
+ <unique_id>25a1464848387259c63200a99f466e8c</unique_id>
7
+ <transaction_id>43671---775fff20a51e01303d37542696cde09d</transaction_id>
8
+ <technical_message>TESTMODE: No real money will be transferred!</technical_message>
9
+ <message>TESTMODE: No real money will be transferred!</message>
10
+ <mode>test</mode>
11
+ <timestamp>2013-05-22T15:00:26Z</timestamp>
12
+ <descriptor>sankyu.com/bogus +49123456789</descriptor>
13
+ <amount>5000</amount>
14
+ <currency>USD</currency>
15
+ </payment_response>
16
+ </payment_responses>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payment_response>
3
+ <transaction_type>recurring_debit_sale</transaction_type>
4
+ <status>pending_async</status>
5
+ <unique_id>751256b04bfadb3530054c0867850740</unique_id>
6
+ <transaction_id>43671---306c4c10baed0130c95f542696cde09d</transaction_id>
7
+ <technical_message>TESTMODE: No real money will be transferred!</technical_message>
8
+ <message>TESTMODE: No real money will be transferred!</message>
9
+ <mode>test</mode>
10
+ <timestamp>2013-06-19T09:02:52Z</timestamp>
11
+ <bank_account_number>xxxxxxxxxx</bank_account_number>
12
+ <bank_number>20050550</bank_number>
13
+ <descriptor>sankyu.com/bogus +49123456789</descriptor>
14
+ <amount>5000</amount>
15
+ <currency>USD</currency>
16
+ </payment_response>
@@ -0,0 +1,22 @@
1
+ {
2
+ "recurring_event":{
3
+ "unique_id":"44177a21403427eb96664a6d7e5d5d48",
4
+ "reference_id":"5e2cbbad71d2b13432323153c208223a",
5
+ "status":"approved",
6
+ "due_date":"2012-04-15",
7
+ "finalized_at":"2012-04-15",
8
+ "payment_response":{
9
+ "transaction_type":"recurring_sale",
10
+ "status":"approved",
11
+ "unique_id":"44177a21403427eb96664a6d7e5d5d48",
12
+ "transaction_id":"3872422-001-1",
13
+ "technical_message":"TESTMODE: No real money will be transferred!",
14
+ "message":"TESTMODE: No real money will be transferred!",
15
+ "mode":"test",
16
+ "timestamp":"2012-04-15T02:00:12Z",
17
+ "descriptor":"descriptor one",
18
+ "amount":"1000",
19
+ "currency":"EUR"
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <recurring_event>
3
+ <unique_id>44177a21403427eb96664a6d7e5d5d48</unique_id>
4
+ <reference_id>5e2cbbad71d2b13432323153c208223a</reference_id>
5
+ <status>approved</status>
6
+ <due_date>2012-04-15</due_date>
7
+ <finalized_at>2012-04-15</finalized_at>
8
+ <payment_response>
9
+ <transaction_type>recurring_sale</transaction_type>
10
+ <status>approved</status>
11
+ <unique_id>44177a21403427eb96664a6d7e5d5d48</unique_id>
12
+ <transaction_id>3872422-001-1</transaction_id>
13
+ <technical_message>TESTMODE: No real money will be transferred!</technical_message>
14
+ <message>TESTMODE: No real money will be transferred!</message>
15
+ <mode>test</mode>
16
+ <timestamp>2012-04-15T02:00:12Z</timestamp>
17
+ <descriptor>descriptor one</descriptor>
18
+ <amount>1000</amount>
19
+ <currency>EUR</currency>
20
+ </payment_response>
21
+ </recurring_event>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payment_response>
3
+ <transaction_type>recurring_sale</transaction_type>
4
+ <status>approved</status>
5
+ <unique_id>254fdd59f60b9caf15f13f2f93b0f721</unique_id>
6
+ <transaction_id>43671---bfc56660baeb0130c958542696cde09d</transaction_id>
7
+ <technical_message>TESTMODE: No real money will be transferred!</technical_message>
8
+ <message>TESTMODE: No real money will be transferred!</message>
9
+ <mode>test</mode>
10
+ <timestamp>2013-06-19T08:52:34Z</timestamp>
11
+ <descriptor>sankyu.com/bogus +49123456789</descriptor>
12
+ <amount>5000</amount>
13
+ <currency>USD</currency>
14
+ </payment_response>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payment_response>
3
+ <transaction_type>referenced_fund_transfer</transaction_type>
4
+ <status>approved</status>
5
+ <unique_id>6a2d35eefcd286723d72a54b7ddc75ce</unique_id>
6
+ <transaction_id>B62D6848-78EA-4910-BFD8-920A3BF10CC5---95731e20bae90130c94f542696cde09d</transaction_id>
7
+ <technical_message>TESTMODE: No real money will be transferred!</technical_message>
8
+ <message>TESTMODE: No real money will be transferred!</message>
9
+ <mode>test</mode>
10
+ <timestamp>2013-06-19T08:37:03Z</timestamp>
11
+ <descriptor>sankyu.com/bogus +49123456789</descriptor>
12
+ <amount>5000</amount>
13
+ <currency>USD</currency>
14
+ </payment_response>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payment_response>
3
+ <transaction_type>refund</transaction_type>
4
+ <status>approved</status>
5
+ <unique_id>3dd0dc99323b2c52535b868e3dbe2a4c</unique_id>
6
+ <transaction_id>0AF671AF-4134-4BE7-BDF0-26E38B74106E---128c33c0a51501303d1e542696cde09d-1</transaction_id>
7
+ <technical_message>TESTMODE: No real money will be transferred!</technical_message>
8
+ <message>TESTMODE: No real money will be transferred!</message>
9
+ <mode>test</mode>
10
+ <timestamp>2013-05-22T13:53:18Z</timestamp>
11
+ <descriptor>sankyu.com/bogus +49123456789</descriptor>
12
+ <amount>5000</amount>
13
+ <currency>USD</currency>
14
+ </payment_response>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payment_response>
3
+ <transaction_type>sale</transaction_type>
4
+ <status>approved</status>
5
+ <unique_id>5e2cbbad71d2b1343232abc3c208223a</unique_id>
6
+ <transaction_id>43671</transaction_id>
7
+ <mode>test</mode>
8
+ <timestamp>2013-04-30T07:07:01Z</timestamp>
9
+ <descriptor>descriptor one</descriptor>
10
+ <amount>5000</amount>
11
+ <currency>USD</currency>
12
+ </payment_response>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payment_response>
3
+ <transaction_type>sale3d</transaction_type>
4
+ <status>pending_async</status>
5
+ <unique_id>ddda0f68a8f12bfca799e8982ceff276</unique_id>
6
+ <transaction_id>43671---487b2e10bae90130c94e542696cde09d</transaction_id>
7
+ <technical_message>TESTMODE: No real money will be transferred!</technical_message>
8
+ <message>TESTMODE: No real money will be transferred!</message>
9
+ <redirect_url>https://test.hypercharge.net/redirect/to_acquirer/ddda0f68a8f12bfca799e8982ceff276</redirect_url>
10
+ <mode>test</mode>
11
+ <timestamp>2013-06-19T08:34:54Z</timestamp>
12
+ <descriptor>sankyu.com/bogus +49123456789</descriptor>
13
+ <amount>5000</amount>
14
+ <currency>USD</currency>
15
+ </payment_response>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payment_response>
3
+ <transaction_type>sale3d</transaction_type>
4
+ <status>approved</status>
5
+ <unique_id>ae69cb8469df4eb1b037c779988feae4</unique_id>
6
+ <transaction_id>43671---f498e310baed0130c961542696cde09d</transaction_id>
7
+ <technical_message>TESTMODE: No real money will be transferred!</technical_message>
8
+ <message>TESTMODE: No real money will be transferred!</message>
9
+ <mode>test</mode>
10
+ <timestamp>2013-06-19T09:08:22Z</timestamp>
11
+ <descriptor>sankyu.com/bogus +49123456789</descriptor>
12
+ <amount>5000</amount>
13
+ <currency>USD</currency>
14
+ </payment_response>
@@ -0,0 +1,8 @@
1
+ {
2
+ "type": "PaginatedCollection",
3
+ "entries_base_type": "PaymentTransaction",
4
+ "entries": [],
5
+ "total_entries": 0,
6
+ "current_page": 1,
7
+ "per_page": 50
8
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "type": "PaginatedCollection",
3
+ "entries_base_type": "PaymentTransaction",
4
+ "entries": [
5
+ {
6
+ "unique_id": "3ba2d77ab04f773c0a47bd1081ac50be",
7
+ "transaction_id": "4",
8
+ "transaction_type": "recurring_sale",
9
+ "amount": 500,
10
+ "currency": "USD",
11
+ "status": "new",
12
+ "mode": "test",
13
+ "descriptor": "Descriptor 1",
14
+ "message": "TESTMODE: No real money will be transferred!",
15
+ "technical_message": "TESTMODE: No real money will be transferred!",
16
+ "timestamp": "2013-08-13T16:59:45Z"
17
+ }
18
+ ],
19
+ "total_entries": 1,
20
+ "current_page": 1,
21
+ "per_page": 50
22
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "type": "DateRecurringSchedule",
3
+ "unique_id": "e1420438c52b4cb3a03a14a7e4fc16e1",
4
+ "payment_transaction_unique_id": "e1420438c52b4cb3a03a14a7e4fc16e1",
5
+ "amount": 73100,
6
+ "interval": "monthly",
7
+ "start_date": "2013-11-13",
8
+ "end_date": "2014-06-30",
9
+ "currency": "USD",
10
+ "active": true,
11
+ "timestamp": "2013-08-13T16:42:09Z"
12
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "type": "PaginatedCollection",
3
+ "entries_base_type": "RecurringSchedule",
4
+ "entries": [],
5
+ "current_page": 1,
6
+ "per_page": 50,
7
+ "total_entries": 0
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "error": {
3
+ "code": 340,
4
+ "message": "Validation failed: Amount InputDataInvalidError: 'recurring_schedule[amount]' is invalid",
5
+ "user_message": "Please check input data for errors!"
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "type":"RecurringEvent",
3
+ "due_date":"2014-06-02"
4
+ }
@@ -0,0 +1,93 @@
1
+ {
2
+ "type": "PaginatedCollection",
3
+ "total_entries": 10,
4
+ "current_page": 1,
5
+ "per_page": 7,
6
+ "entries_base_type": "RecurringSchedule",
7
+ "entries": [
8
+ {
9
+ "timestamp": "2014-05-10T12:00:00Z",
10
+ "payment_transaction_unique_id": "0293069be5a868ae69290e8a0eff72b3",
11
+ "currency": "USD",
12
+ "unique_id": "0293069be5a868ae69290e8a0eff72b3",
13
+ "interval": "monthly",
14
+ "active": true,
15
+ "start_date": "2014-06-10",
16
+ "end_date": "2015-05-10",
17
+ "type": "DateRecurringSchedule",
18
+ "amount": 500
19
+ },
20
+ {
21
+ "timestamp": "2014-05-11T12:00:00Z",
22
+ "payment_transaction_unique_id": "0763d2761d004a86f24807594610900b",
23
+ "currency": "USD",
24
+ "unique_id": "0763d2761d004a86f24807594610900b",
25
+ "interval": "monthly",
26
+ "active": true,
27
+ "start_date": "2014-06-11",
28
+ "end_date": "2015-05-11",
29
+ "type": "DateRecurringSchedule",
30
+ "amount": 500
31
+ },
32
+ {
33
+ "timestamp": "2014-05-12T12:00:00Z",
34
+ "payment_transaction_unique_id": "22cd57da4a1c36652b6eb3e5b7587b03",
35
+ "currency": "USD",
36
+ "unique_id": "22cd57da4a1c36652b6eb3e5b7587b03",
37
+ "interval": "monthly",
38
+ "active": true,
39
+ "start_date": "2014-06-12",
40
+ "end_date": "2015-05-12",
41
+ "type": "DateRecurringSchedule",
42
+ "amount": 500
43
+ },
44
+ {
45
+ "timestamp": "2014-05-13T12:00:00Z",
46
+ "payment_transaction_unique_id": "d07061244f5a468271bf27486ccfcaa2",
47
+ "currency": "USD",
48
+ "unique_id": "d07061244f5a468271bf27486ccfcaa2",
49
+ "interval": "monthly",
50
+ "active": true,
51
+ "start_date": "2014-06-13",
52
+ "end_date": "2015-05-13",
53
+ "type": "DateRecurringSchedule",
54
+ "amount": 500
55
+ },
56
+ {
57
+ "timestamp": "2014-05-14T12:00:00Z",
58
+ "payment_transaction_unique_id": "ff700580d3c19e1f1d8f6364c1c7d707",
59
+ "currency": "USD",
60
+ "unique_id": "ff700580d3c19e1f1d8f6364c1c7d707",
61
+ "interval": "monthly",
62
+ "active": true,
63
+ "start_date": "2014-06-14",
64
+ "end_date": "2015-05-14",
65
+ "type": "DateRecurringSchedule",
66
+ "amount": 500
67
+ },
68
+ {
69
+ "timestamp": "2014-05-15T12:00:00Z",
70
+ "payment_transaction_unique_id": "f3268a2e9ae4d389d92d4503c480c67d",
71
+ "currency": "USD",
72
+ "unique_id": "f3268a2e9ae4d389d92d4503c480c67d",
73
+ "interval": "monthly",
74
+ "active": true,
75
+ "start_date": "2014-06-15",
76
+ "end_date": "2015-05-15",
77
+ "type": "DateRecurringSchedule",
78
+ "amount": 500
79
+ },
80
+ {
81
+ "timestamp": "2014-05-16T12:00:00Z",
82
+ "payment_transaction_unique_id": "c4e9afeddc0c7dd907433187ac86e1bd",
83
+ "currency": "USD",
84
+ "unique_id": "c4e9afeddc0c7dd907433187ac86e1bd",
85
+ "interval": "monthly",
86
+ "active": true,
87
+ "start_date": "2014-06-16",
88
+ "end_date": "2015-05-16",
89
+ "type": "DateRecurringSchedule",
90
+ "amount": 500
91
+ }
92
+ ]
93
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "type": "PaginatedCollection",
3
+ "total_entries": 10,
4
+ "current_page": 2,
5
+ "per_page": 7,
6
+ "entries_base_type": "RecurringSchedule",
7
+ "entries": [
8
+ {
9
+ "timestamp": "2014-05-17T12:00:00Z",
10
+ "payment_transaction_unique_id": "b39cf4adcdea97eb55903eab47518272",
11
+ "currency": "USD",
12
+ "unique_id": "b39cf4adcdea97eb55903eab47518272",
13
+ "interval": "monthly",
14
+ "active": true,
15
+ "start_date": "2014-06-17",
16
+ "end_date": "2015-05-17",
17
+ "type": "DateRecurringSchedule",
18
+ "amount": 500
19
+ },
20
+ {
21
+ "timestamp": "2014-05-18T12:00:00Z",
22
+ "payment_transaction_unique_id": "912f9a230e6f5166f2708616cf7ee805",
23
+ "currency": "USD",
24
+ "unique_id": "912f9a230e6f5166f2708616cf7ee805",
25
+ "interval": "monthly",
26
+ "active": true,
27
+ "start_date": "2014-06-18",
28
+ "end_date": "2015-05-18",
29
+ "type": "DateRecurringSchedule",
30
+ "amount": 500
31
+ },
32
+ {
33
+ "timestamp": "2014-05-19T12:00:00Z",
34
+ "payment_transaction_unique_id": "c14bb3479c669ecd5393ba700a01392b",
35
+ "currency": "USD",
36
+ "unique_id": "c14bb3479c669ecd5393ba700a01392b",
37
+ "interval": "monthly",
38
+ "active": true,
39
+ "start_date": "2014-06-19",
40
+ "end_date": "2015-05-19",
41
+ "type": "DateRecurringSchedule",
42
+ "amount": 500
43
+ }
44
+ ]
45
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "type": "PaginatedCollection",
3
+ "total_entries": 1,
4
+ "current_page": 1,
5
+ "per_page": 50,
6
+ "entries_base_type": "RecurringSchedule",
7
+ "entries": [
8
+ {
9
+ "timestamp": "2014-05-10T12:00:00Z",
10
+ "payment_transaction_unique_id": "0293069be5a868ae69290e8a0eff72b3",
11
+ "currency": "USD",
12
+ "unique_id": "0293069be5a868ae69290e8a0eff72b3",
13
+ "interval": "monthly",
14
+ "active": true,
15
+ "start_date": "2014-06-10",
16
+ "end_date": "2015-05-10",
17
+ "type": "DateRecurringSchedule",
18
+ "amount": 500
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payment_response>
3
+ <transaction_type>void</transaction_type>
4
+ <status>approved</status>
5
+ <unique_id>f8a230d1013fd9f3048afe131ea7dcba</unique_id>
6
+ <transaction_id>0AF671AF-4134-4BE7-BDF0-26E38B74106E---c778d710a51401303d1d542696cde09d-1</transaction_id>
7
+ <technical_message>TESTMODE: No real money will be transferred!</technical_message>
8
+ <message>TESTMODE: No real money will be transferred!</message>
9
+ <mode>test</mode>
10
+ <timestamp>2013-05-22T13:51:11Z</timestamp>
11
+ <descriptor>sankyu.com/bogus +49123456789</descriptor>
12
+ </payment_response>
@@ -0,0 +1,287 @@
1
+ 'use strict';
2
+
3
+ /*jsl predef:define*/
4
+ /*jsl predef:it*/
5
+
6
+ var util = require('util')
7
+ var fs = require('fs')
8
+ var assert = require('chai').assert
9
+ var Validator = require('jsonschema').Validator
10
+
11
+
12
+ describe('MobilePayment', function () {
13
+ var json, validator, schema, paymentSchema, paymentRequest, payment;
14
+
15
+ beforeEach(function () {
16
+ if(!json) {
17
+ json = {
18
+ schema :fs.readFileSync('json/MobilePayment.json')
19
+ ,paymentSchema :fs.readFileSync('json/Payment.json')
20
+ ,types :fs.readFileSync('json/types.json')
21
+ ,request:fs.readFileSync('test/fixtures/MobilePayment.json')
22
+ }
23
+ }
24
+ validator = new Validator()
25
+ schema = JSON.parse(json.schema)
26
+ paymentRequest = JSON.parse(json.request)
27
+ validator.addSchema(JSON.parse(json.paymentSchema), '/Payment.json')
28
+ validator.addSchema(JSON.parse(json.types), '/types.json')
29
+ payment = paymentRequest.payment
30
+ })
31
+
32
+ function assertValid(payment) {
33
+ validate(payment, true)
34
+ }
35
+ function assertNotValid(payment) {
36
+ validate(payment, false)
37
+ }
38
+ function validate(payment, bool) {
39
+ var result = validator.validate(payment, schema)
40
+ assert.strictEqual(result.valid, bool, util.inspect(result.errors, { showHidden: false, depth: 1 }))
41
+ }
42
+
43
+ describe('fixture', function () {
44
+ it('should validate', function () {
45
+ assertValid(paymentRequest)
46
+ })
47
+ it('with wrong root node is not valid', function(){
48
+ assertNotValid({wrong_root:payment})
49
+ })
50
+ it('should not allow additional root nodes', function(){
51
+ paymentRequest.additional_node = 'foo';
52
+ assertNotValid(paymentRequest)
53
+ })
54
+
55
+ // TODO the ruby json-schema validator doesnt work with additionalProperties:false in MobilePayment.json
56
+ // atm. the restriction is off.
57
+ it('should not allow additional payment nodes', function(){
58
+ paymentRequest.payment.additional_node = 'foo';
59
+ assertNotValid(paymentRequest)
60
+ })
61
+ })
62
+
63
+ describe('amount valid', function() {
64
+ it('1', function () {
65
+ payment.amount = 1;
66
+ assertValid(paymentRequest)
67
+ })
68
+ it('1000000000', function () {
69
+ payment.amount = 1000000000;
70
+ assertValid(paymentRequest)
71
+ })
72
+ })
73
+
74
+ describe('amount not valid', function() {
75
+ it('missing', function () {
76
+ delete(payment.amount)
77
+ assertNotValid(paymentRequest)
78
+ })
79
+ it('1.2', function () {
80
+ payment.amount = 1.2;
81
+ assertNotValid(paymentRequest)
82
+ })
83
+ it('0', function () {
84
+ payment.amount = 0;
85
+ assertNotValid(paymentRequest)
86
+ })
87
+ it('-1', function () {
88
+ payment.amount = -1;
89
+ assertNotValid(paymentRequest)
90
+ })
91
+ it('-1.2', function () {
92
+ payment.amount = -1.2;
93
+ assertNotValid(paymentRequest)
94
+ })
95
+ it('foo', function () {
96
+ payment.amount = 'foo';
97
+ assertNotValid(paymentRequest)
98
+ })
99
+ })
100
+
101
+ describe('currency valid', function() {
102
+ it('EUR', function () {
103
+ payment.currency = 'EUR';
104
+ assertValid(paymentRequest)
105
+ })
106
+ it('USD', function () {
107
+ payment.currency = 'USD';
108
+ assertValid(paymentRequest)
109
+ })
110
+ })
111
+
112
+ describe('currency not valid', function() {
113
+ it('missing', function () {
114
+ delete(payment.currency)
115
+ assertNotValid(paymentRequest)
116
+ })
117
+ it('""', function () {
118
+ payment.currency = ''
119
+ assertNotValid(paymentRequest)
120
+ })
121
+ it('€', function () {
122
+ payment.currency = '€';
123
+ assertNotValid(paymentRequest)
124
+ })
125
+ it('$', function () {
126
+ payment.currency = '$';
127
+ assertNotValid(paymentRequest)
128
+ })
129
+ it('XXX', function () {
130
+ payment.currency = 'XXX';
131
+ assertNotValid(paymentRequest)
132
+ })
133
+ it('0', function () {
134
+ payment.amount = 0;
135
+ assertNotValid(paymentRequest)
136
+ })
137
+ })
138
+
139
+ describe('notification_url valid', function() {
140
+ it('http', function () {
141
+ payment.notification_url = 'http://test-server.de/hypercharge/payment-notification.php';
142
+ assertValid(paymentRequest)
143
+ })
144
+ it('https', function () {
145
+ payment.notification_url = 'https://test-server.de/hypercharge/payment-notification.php';
146
+ assertValid(paymentRequest)
147
+ })
148
+ })
149
+
150
+ describe('notification_url not valid', function() {
151
+ it('missing', function () {
152
+ delete(payment.notification_url)
153
+ assertNotValid(paymentRequest)
154
+ })
155
+ it('""', function () {
156
+ payment.notification_url = '';
157
+ assertNotValid(paymentRequest)
158
+ })
159
+ it('77', function () {
160
+ payment.notification_url = 77;
161
+ assertNotValid(paymentRequest)
162
+ })
163
+ it('"file:///...."', function () {
164
+ payment.notification_url = "file:///Home/homer/simpson.txt";
165
+ assertNotValid(paymentRequest)
166
+ })
167
+ it('http but too short', function () {
168
+ payment.notification_url = 'http://';
169
+ assertNotValid(paymentRequest)
170
+ })
171
+ })
172
+
173
+ describe('customer_email valid', function() {
174
+ it('jan@hypercharge.net', function () {
175
+ payment.customer_email = 'jan@hypercharge.net';
176
+ assertValid(paymentRequest)
177
+ })
178
+ it('missing', function () {
179
+ delete(payment.customer_email)
180
+ assertValid(paymentRequest)
181
+ })
182
+ })
183
+
184
+ describe('customer_email not valid', function() {
185
+ it('""', function () {
186
+ payment.customer_email = ''
187
+ assertNotValid(paymentRequest)
188
+ })
189
+ it('null', function () {
190
+ payment.customer_email = null
191
+ assertNotValid(paymentRequest)
192
+ })
193
+ })
194
+
195
+
196
+ describe('billing_address', function() {
197
+ it('missing is valid', function () {
198
+ assert.typeOf(payment.billing_address, 'object', 'billing_address')
199
+ delete(payment.billing_address)
200
+ assertValid(paymentRequest)
201
+ })
202
+
203
+ it('missing first_name is invalid', function () {
204
+ delete(payment.billing_address.first_name)
205
+ assertNotValid(paymentRequest)
206
+ })
207
+ it('missing last_name is invalid', function () {
208
+ delete(payment.billing_address.last_name)
209
+ assertNotValid(paymentRequest)
210
+ })
211
+ it('missing address1 is invalid', function () {
212
+ delete(payment.billing_address.address1)
213
+ assertNotValid(paymentRequest)
214
+ })
215
+ it('missing address2 is valid', function () {
216
+ delete(payment.billing_address.address2)
217
+ assertValid(paymentRequest)
218
+ })
219
+ it('missing city is invalid', function () {
220
+ delete(payment.billing_address.city)
221
+ assertNotValid(paymentRequest)
222
+ })
223
+ it('missing zip_code is invalid', function () {
224
+ delete(payment.billing_address.zip_code)
225
+ assertNotValid(paymentRequest)
226
+ })
227
+ it('missing country is invalid', function () {
228
+ delete(payment.billing_address.country)
229
+ assertNotValid(paymentRequest)
230
+ })
231
+ it('present state invalid', function () {
232
+ payment.billing_address.state = 'CA'
233
+ assertValid(paymentRequest)
234
+ })
235
+ it('wrong state invalid', function () {
236
+ payment.billing_address.state = 'ZZ'
237
+ assertNotValid(paymentRequest)
238
+ })
239
+ })
240
+
241
+
242
+ describe('expires_in valid', function() {
243
+ it('min', function () {
244
+ payment.expires_in = 300;
245
+ assertValid(paymentRequest)
246
+ })
247
+ it('between', function () {
248
+ payment.expires_in = 5000;
249
+ assertValid(paymentRequest)
250
+ })
251
+ it('float but quasi int', function () {
252
+ payment.expires_in = 5000.0;
253
+ assertValid(paymentRequest)
254
+ })
255
+ it('max', function () {
256
+ payment.expires_in = 86400;
257
+ assertValid(paymentRequest)
258
+ })
259
+ it('missing', function () {
260
+ delete(payment.expires_in)
261
+ assertValid(paymentRequest)
262
+ })
263
+ })
264
+
265
+ describe('expires_in not valid', function() {
266
+ it('""', function () {
267
+ payment.expires_in = ''
268
+ assertNotValid(paymentRequest)
269
+ })
270
+ it('null', function () {
271
+ payment.expires_in = null
272
+ assertNotValid(paymentRequest)
273
+ })
274
+ it('min -1', function () {
275
+ payment.expires_in = 300 -1;
276
+ assertNotValid(paymentRequest)
277
+ })
278
+ it('max +1', function () {
279
+ payment.expires_in = 86400 +1;
280
+ assertNotValid(paymentRequest)
281
+ })
282
+ it('float', function () {
283
+ payment.expires_in = 5000.1;
284
+ assertNotValid(paymentRequest)
285
+ })
286
+ })
287
+ })