paypal-payment 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. data/.gitignore +19 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +18 -0
  4. data/Guardfile +24 -0
  5. data/README.rdoc +107 -0
  6. data/Rakefile +5 -0
  7. data/docs/AdaptivePayments.rdoc +84 -0
  8. data/docs/PP_NVPAPI_DeveloperGuide.pdf +0 -0
  9. data/docs/PP_WPP_IntegrationGuide.pdf +0 -0
  10. data/docs/adaptive_payments.md +55 -0
  11. data/docs/api.txt +67 -0
  12. data/docs/design.txt +38 -0
  13. data/docs/express_checkout.md +172 -0
  14. data/docs/requirements.txt +32 -0
  15. data/lib/paypal-payment.rb +10 -0
  16. data/lib/paypal/adaptive_payments.rb +31 -0
  17. data/lib/paypal/adaptive_payments/api.rb +51 -0
  18. data/lib/paypal/adaptive_payments/base.rb +11 -0
  19. data/lib/paypal/adaptive_payments/client_details.rb +14 -0
  20. data/lib/paypal/adaptive_payments/display_options.rb +10 -0
  21. data/lib/paypal/adaptive_payments/funding_constraint.rb +11 -0
  22. data/lib/paypal/adaptive_payments/funding_type_info.rb +8 -0
  23. data/lib/paypal/adaptive_payments/funding_type_list.rb +11 -0
  24. data/lib/paypal/adaptive_payments/initiating_entity.rb +11 -0
  25. data/lib/paypal/adaptive_payments/institution_customer.rb +13 -0
  26. data/lib/paypal/adaptive_payments/invoice_data.rb +13 -0
  27. data/lib/paypal/adaptive_payments/invoice_item.rb +11 -0
  28. data/lib/paypal/adaptive_payments/payment.rb +105 -0
  29. data/lib/paypal/adaptive_payments/payment_info.rb +18 -0
  30. data/lib/paypal/adaptive_payments/payment_info_list.rb +11 -0
  31. data/lib/paypal/adaptive_payments/payment_options.rb +39 -0
  32. data/lib/paypal/adaptive_payments/phone.rb +9 -0
  33. data/lib/paypal/adaptive_payments/preapproval.rb +52 -0
  34. data/lib/paypal/adaptive_payments/receiver.rb +17 -0
  35. data/lib/paypal/adaptive_payments/receiver_list.rb +49 -0
  36. data/lib/paypal/adaptive_payments/receiver_options.rb +19 -0
  37. data/lib/paypal/adaptive_payments/request.rb +51 -0
  38. data/lib/paypal/adaptive_payments/response.rb +38 -0
  39. data/lib/paypal/adaptive_payments/response/address.rb +13 -0
  40. data/lib/paypal/adaptive_payments/response/address_list.rb +11 -0
  41. data/lib/paypal/adaptive_payments/response/base_address.rb +13 -0
  42. data/lib/paypal/adaptive_payments/response/details.rb +19 -0
  43. data/lib/paypal/adaptive_payments/response/error_list.rb +15 -0
  44. data/lib/paypal/adaptive_payments/response/pay.rb +31 -0
  45. data/lib/paypal/adaptive_payments/response/pay_error.rb +16 -0
  46. data/lib/paypal/adaptive_payments/response/pay_error_list.rb +15 -0
  47. data/lib/paypal/adaptive_payments/response/pay_options.rb +7 -0
  48. data/lib/paypal/adaptive_payments/response/preapproval.rb +47 -0
  49. data/lib/paypal/adaptive_payments/response/refund.rb +16 -0
  50. data/lib/paypal/adaptive_payments/response/refund_info.rb +24 -0
  51. data/lib/paypal/adaptive_payments/response/refund_info_list.rb +11 -0
  52. data/lib/paypal/adaptive_payments/response/shipping_address.rb +11 -0
  53. data/lib/paypal/adaptive_payments/sender_identifier.rb +7 -0
  54. data/lib/paypal/adaptive_payments/sender_options.rb +8 -0
  55. data/lib/paypal/api.rb +94 -0
  56. data/lib/paypal/cacert.pem +3987 -0
  57. data/lib/paypal/common.rb +11 -0
  58. data/lib/paypal/common/base.rb +83 -0
  59. data/lib/paypal/common/error_data.rb +15 -0
  60. data/lib/paypal/common/request.rb +45 -0
  61. data/lib/paypal/common/request_envelope.rb +13 -0
  62. data/lib/paypal/common/response.rb +34 -0
  63. data/lib/paypal/common/response_envelope.rb +19 -0
  64. data/lib/paypal/express_checkout.rb +19 -0
  65. data/lib/paypal/express_checkout/account.rb +16 -0
  66. data/lib/paypal/express_checkout/api.rb +43 -0
  67. data/lib/paypal/express_checkout/base.rb +37 -0
  68. data/lib/paypal/express_checkout/billing.rb +7 -0
  69. data/lib/paypal/express_checkout/callback.rb +17 -0
  70. data/lib/paypal/express_checkout/checkout.rb +144 -0
  71. data/lib/paypal/express_checkout/fields.rb +449 -0
  72. data/lib/paypal/express_checkout/fmf.rb +7 -0
  73. data/lib/paypal/express_checkout/payment.rb +76 -0
  74. data/lib/paypal/express_checkout/payment_item.rb +7 -0
  75. data/lib/paypal/express_checkout/recurring.rb +131 -0
  76. data/lib/paypal/express_checkout/request.rb +212 -0
  77. data/lib/paypal/express_checkout/response.rb +52 -0
  78. data/lib/paypal/express_checkout/response/account.rb +30 -0
  79. data/lib/paypal/express_checkout/response/address.rb +29 -0
  80. data/lib/paypal/express_checkout/response/authorization.rb +25 -0
  81. data/lib/paypal/express_checkout/response/base.rb +125 -0
  82. data/lib/paypal/express_checkout/response/callback_request.rb +10 -0
  83. data/lib/paypal/express_checkout/response/callback_response.rb +8 -0
  84. data/lib/paypal/express_checkout/response/capture.rb +14 -0
  85. data/lib/paypal/express_checkout/response/checkout.rb +11 -0
  86. data/lib/paypal/express_checkout/response/details.rb +35 -0
  87. data/lib/paypal/express_checkout/response/manage_profile.rb +9 -0
  88. data/lib/paypal/express_checkout/response/notification.rb +85 -0
  89. data/lib/paypal/express_checkout/response/payment.rb +24 -0
  90. data/lib/paypal/express_checkout/response/profile.rb +58 -0
  91. data/lib/paypal/express_checkout/response/reference.rb +11 -0
  92. data/lib/paypal/express_checkout/response/refund.rb +13 -0
  93. data/lib/paypal/express_checkout/response/search.rb +33 -0
  94. data/lib/paypal/express_checkout/response/transaction_details.rb +11 -0
  95. data/lib/paypal/express_checkout/shipping_option.rb +7 -0
  96. data/lib/paypal/express_checkout/utils.rb +26 -0
  97. data/lib/paypal/express_checkout/version.rb +10 -0
  98. data/lib/paypal/invoice.rb +22 -0
  99. data/lib/paypal/invoice/api.rb +51 -0
  100. data/lib/paypal/invoice/base.rb +11 -0
  101. data/lib/paypal/invoice/base_address.rb +11 -0
  102. data/lib/paypal/invoice/business_info.rb +17 -0
  103. data/lib/paypal/invoice/date_range.rb +8 -0
  104. data/lib/paypal/invoice/invoice.rb +117 -0
  105. data/lib/paypal/invoice/invoice_details.rb +38 -0
  106. data/lib/paypal/invoice/invoice_item.rb +13 -0
  107. data/lib/paypal/invoice/invoice_item_list.rb +10 -0
  108. data/lib/paypal/invoice/invoice_summary.rb +22 -0
  109. data/lib/paypal/invoice/invoice_summary_list.rb +10 -0
  110. data/lib/paypal/invoice/other_payment_details.rb +13 -0
  111. data/lib/paypal/invoice/payment_details.rb +16 -0
  112. data/lib/paypal/invoice/paypal_payment_details.rb +11 -0
  113. data/lib/paypal/invoice/request.rb +43 -0
  114. data/lib/paypal/invoice/response.rb +27 -0
  115. data/lib/paypal/invoice/response/details.rb +23 -0
  116. data/lib/paypal/invoice/response/invoice.rb +10 -0
  117. data/lib/paypal/invoice/response/search.rb +15 -0
  118. data/lib/paypal/invoice/search.rb +19 -0
  119. data/lib/paypal/invoice/search_parameters.rb +20 -0
  120. data/lib/paypal/permissions.rb +12 -0
  121. data/lib/paypal/permissions/api.rb +60 -0
  122. data/lib/paypal/permissions/base.rb +11 -0
  123. data/lib/paypal/permissions/permission.rb +33 -0
  124. data/lib/paypal/permissions/personal_data.rb +17 -0
  125. data/lib/paypal/permissions/request.rb +52 -0
  126. data/lib/paypal/permissions/response.rb +24 -0
  127. data/lib/paypal/permissions/response/permission.rb +14 -0
  128. data/lib/paypal/permissions/response/personal_data.rb +8 -0
  129. data/lib/paypal/permissions/response/token.rb +10 -0
  130. data/lib/paypal/permissions/token.rb +13 -0
  131. data/lib/paypal/recurring.rb +110 -0
  132. data/lib/paypal/request.rb +82 -0
  133. data/lib/paypal/version.rb +8 -0
  134. data/paypal-payment.gemspec +30 -0
  135. data/spec/fixtures/adaptive_payments/payment/create/failure.yml +62 -0
  136. data/spec/fixtures/adaptive_payments/payment/create/success.yml +58 -0
  137. data/spec/fixtures/adaptive_payments/payment/details/success.yml +113 -0
  138. data/spec/fixtures/adaptive_payments/payment/pay/failure.yml +62 -0
  139. data/spec/fixtures/adaptive_payments/payment/pay/preapproval.yml +58 -0
  140. data/spec/fixtures/adaptive_payments/payment/pay/success.yml +58 -0
  141. data/spec/fixtures/adaptive_payments/payment/pay/with_pay_key.yml +58 -0
  142. data/spec/fixtures/adaptive_payments/payment/refund/failure.yml +62 -0
  143. data/spec/fixtures/adaptive_payments/payment/refund/success.yml +58 -0
  144. data/spec/fixtures/adaptive_payments/payment/shipping_addresses/success.yml +113 -0
  145. data/spec/fixtures/adaptive_payments/payment_options/get/success.yml +174 -0
  146. data/spec/fixtures/adaptive_payments/payment_options/set/success.yml +113 -0
  147. data/spec/fixtures/adaptive_payments/preapproval/create/success.yml +58 -0
  148. data/spec/fixtures/adaptive_payments/preapproval/details/success.yml +168 -0
  149. data/spec/fixtures/express_checkout/account/balance/success.yml +32 -0
  150. data/spec/fixtures/express_checkout/account/pal_details/success.yml +32 -0
  151. data/spec/fixtures/express_checkout/checkout/checkout/sales/success.yml +61 -0
  152. data/spec/fixtures/express_checkout/checkout/checkout/success.yml +32 -0
  153. data/spec/fixtures/express_checkout/checkout/details/failure.yml +32 -0
  154. data/spec/fixtures/express_checkout/checkout/details/success.yml +61 -0
  155. data/spec/fixtures/express_checkout/checkout/pay/sales/success.yml +61 -0
  156. data/spec/fixtures/express_checkout/checkout/pay/success.yml +61 -0
  157. data/spec/fixtures/express_checkout/payment/details/failure.yml +32 -0
  158. data/spec/fixtures/express_checkout/payment/details/success.yml +32 -0
  159. data/spec/fixtures/express_checkout/payment/refund/failure.yml +32 -0
  160. data/spec/fixtures/express_checkout/payment/refund/success.yml +32 -0
  161. data/spec/fixtures/express_checkout/payment/search/success.yml +32 -0
  162. data/spec/fixtures/express_checkout/recurring/cancel/failure.yml +32 -0
  163. data/spec/fixtures/express_checkout/recurring/cancel/success.yml +32 -0
  164. data/spec/fixtures/express_checkout/recurring/checkout/success.yml +32 -0
  165. data/spec/fixtures/express_checkout/recurring/create_profile/failure.yml +32 -0
  166. data/spec/fixtures/express_checkout/recurring/create_profile/success.yml +61 -0
  167. data/spec/fixtures/express_checkout/recurring/profile/failure.yml +32 -0
  168. data/spec/fixtures/express_checkout/recurring/profile/success.yml +32 -0
  169. data/spec/fixtures/express_checkout/recurring/reactivate/failure.yml +32 -0
  170. data/spec/fixtures/express_checkout/recurring/reactivate/success.yml +32 -0
  171. data/spec/fixtures/express_checkout/recurring/suspend/failure.yml +32 -0
  172. data/spec/fixtures/express_checkout/recurring/suspend/success.yml +32 -0
  173. data/spec/fixtures/express_checkout/recurring/update_profile/failure.yml +32 -0
  174. data/spec/fixtures/express_checkout/recurring/update_profile/profile.yml +32 -0
  175. data/spec/fixtures/express_checkout/recurring/update_profile/success.yml +32 -0
  176. data/spec/fixtures/invoice/cancel/success.yml +174 -0
  177. data/spec/fixtures/invoice/create/failure.yml +62 -0
  178. data/spec/fixtures/invoice/create/success.yml +60 -0
  179. data/spec/fixtures/invoice/create_and_send/failure.yml +62 -0
  180. data/spec/fixtures/invoice/create_and_send/success.yml +60 -0
  181. data/spec/fixtures/invoice/details/success.yml +117 -0
  182. data/spec/fixtures/invoice/mark_as_paid/failure.yml +180 -0
  183. data/spec/fixtures/invoice/mark_as_paid/success.yml +174 -0
  184. data/spec/fixtures/invoice/mark_as_refunded/success.yml +174 -0
  185. data/spec/fixtures/invoice/mark_as_unpaid/success.yml +231 -0
  186. data/spec/fixtures/invoice/search/success.yml +174 -0
  187. data/spec/fixtures/invoice/send/success.yml +117 -0
  188. data/spec/fixtures/invoice/update/failure.yml +119 -0
  189. data/spec/fixtures/invoice/update/success.yml +117 -0
  190. data/spec/fixtures/ipn/express_checkout.json +35 -0
  191. data/spec/fixtures/ipn/recurring_payment.json +44 -0
  192. data/spec/fixtures/ipn/recurring_payment_profile_created.json +31 -0
  193. data/spec/fixtures/ipn/recurring_payment_profile_created_with_initial_amount.json +33 -0
  194. data/spec/fixtures/ipn/recurring_payment_skipped.json +30 -0
  195. data/spec/fixtures/ipn/recurring_payment_with_initial_amount.json +44 -0
  196. data/spec/fixtures/notification/failure.yml +50 -0
  197. data/spec/fixtures/notification/success.yml +50 -0
  198. data/spec/paypal/adaptive_payments/api_spec.rb +20 -0
  199. data/spec/paypal/adaptive_payments/payment/base_spec.rb +28 -0
  200. data/spec/paypal/adaptive_payments/payment/create_spec.rb +63 -0
  201. data/spec/paypal/adaptive_payments/payment/details_spec.rb +34 -0
  202. data/spec/paypal/adaptive_payments/payment/pay_spec.rb +97 -0
  203. data/spec/paypal/adaptive_payments/payment/refund_spec.rb +49 -0
  204. data/spec/paypal/adaptive_payments/payment/shipping_addresses_spec.rb +30 -0
  205. data/spec/paypal/adaptive_payments/payment_options/get_spec.rb +33 -0
  206. data/spec/paypal/adaptive_payments/payment_options/set_spec.rb +66 -0
  207. data/spec/paypal/adaptive_payments/preapproval/cancel_spec.rb +34 -0
  208. data/spec/paypal/adaptive_payments/preapproval/create_spec.rb +39 -0
  209. data/spec/paypal/adaptive_payments/preapproval/details_spec.rb +34 -0
  210. data/spec/paypal/adaptive_payments/request_spec.rb +48 -0
  211. data/spec/paypal/api_spec.rb +78 -0
  212. data/spec/paypal/common/base_spec.rb +157 -0
  213. data/spec/paypal/common/error_data_spec.rb +0 -0
  214. data/spec/paypal/common/request_envelope_spec.rb +6 -0
  215. data/spec/paypal/common/response_spec.rb +0 -0
  216. data/spec/paypal/express_checkout/account/balance_spec.rb +25 -0
  217. data/spec/paypal/express_checkout/account/pal_details_spec.rb +20 -0
  218. data/spec/paypal/express_checkout/checkout/checkout_spec.rb +73 -0
  219. data/spec/paypal/express_checkout/checkout/details_spec.rb +70 -0
  220. data/spec/paypal/express_checkout/checkout/pay_spec.rb +68 -0
  221. data/spec/paypal/express_checkout/fields_spec.rb +138 -0
  222. data/spec/paypal/express_checkout/payment/refund_spec.rb +34 -0
  223. data/spec/paypal/express_checkout/payment/search_spec.rb +24 -0
  224. data/spec/paypal/express_checkout/payment/transaction_details_spec.rb +30 -0
  225. data/spec/paypal/express_checkout/payment_spec.rb +13 -0
  226. data/spec/paypal/express_checkout/recurring/create_profile_spec.rb +50 -0
  227. data/spec/paypal/express_checkout/recurring/manage_profile_spec.rb +62 -0
  228. data/spec/paypal/express_checkout/recurring/profile_spec.rb +44 -0
  229. data/spec/paypal/express_checkout/recurring/update_profile_spec.rb +50 -0
  230. data/spec/paypal/express_checkout/request_spec.rb +221 -0
  231. data/spec/paypal/express_checkout/response/account_spec.rb +33 -0
  232. data/spec/paypal/express_checkout/response/base_spec.rb +253 -0
  233. data/spec/paypal/invoice/cancel_spec.rb +38 -0
  234. data/spec/paypal/invoice/create_and_send_spec.rb +58 -0
  235. data/spec/paypal/invoice/create_spec.rb +58 -0
  236. data/spec/paypal/invoice/details_spec.rb +39 -0
  237. data/spec/paypal/invoice/mark_as_paid_spec.rb +75 -0
  238. data/spec/paypal/invoice/mark_as_refunded_spec.rb +47 -0
  239. data/spec/paypal/invoice/mark_as_unpaid_spec.rb +43 -0
  240. data/spec/paypal/invoice/search_spec.rb +70 -0
  241. data/spec/paypal/invoice/send_spec.rb +48 -0
  242. data/spec/paypal/invoice/update_spec.rb +72 -0
  243. data/spec/paypal/request_spec.rb +45 -0
  244. data/spec/spec_helper.rb +35 -0
  245. metadata +546 -0
@@ -0,0 +1,449 @@
1
+ module PayPal
2
+ module ExpressCheckout
3
+ module Fields
4
+ ATTRIBUTES = {
5
+ :checkout => {
6
+ :max_amount => "MAXAMT",
7
+ :return_url => "RETURNURL",
8
+ :cancel_url => "CANCELURL",
9
+ :callback => "CALLBACK",
10
+ :callback_timeount => "CALLBACKTIMEOUT",
11
+ :confirm_shipping => "REQCONFIRMSHIPPING", # 0, 1
12
+ :no_shipping => "NOSHIPPING",
13
+ :allow_note => "ALLOWNOTE",
14
+ :address_override => "ADDROVERRIDE",
15
+ :callback_version => "CALLBACKVERSION",
16
+ :locale => "LOCALECODE",
17
+ :page_style => "PAGESTYLE",
18
+ :header_image => "HDRIMG",
19
+ :header_border_color => "HDRBORDERCOLOR",
20
+ :header_background_color => "HDRBACKCOLOR",
21
+ :payflow_color => "PAYFLOWCOLOR",
22
+ :solution_type => "SOLUTIONTYPE", # Sole, Mark
23
+ :landing_page => "LANDINGPAGE", # Billing, Login
24
+ :channel_type => "CHANNELTYPE", # Merchant, eBayItem
25
+ :brand_name => "BRANDNAME",
26
+ :customer_service_num => "CUSTOMERSERVICENUMBER",
27
+ :phone_num => "PHONENUM",
28
+ :token => "TOKEN",
29
+ :payer_id => "PAYERID",
30
+ :return_fmf_details => "RETURNFMFDETAILS", # 0, 1
31
+ :paypal_adjustment => "PAYPALADJUSTMENT",
32
+ :redirect_required => "REDIRECTREQUIRED",
33
+ :checkout_status => "CHECKOUTSTATUS"
34
+ },
35
+ :giro => {
36
+ :giropay_success_url => "GIROPAYSUCCESSURL",
37
+ :giropay_cancel_url => "GIROPAYCANCELURL",
38
+ :bank_txn_pending_url => "BANKTXNPENDINGURL",
39
+ },
40
+ :gift => {
41
+ :gift_message => "GIFTMESSAGE",
42
+ :gift_receipt_enabled => "GIFTRECEIPTENABLE",
43
+ :gift_wrap_name => "GIFTWRAPNAME",
44
+ :gift_wrap_amount => "GIFTWRAPAMOUNT"
45
+ },
46
+ :survey => {
47
+ :survey_question => "SURVEYQUESTION",
48
+ :survey_enabled => "SURVEYENABLE", # 0, 1
49
+ :survey_choice_selected => "SURVEYCHOICESELECTED",
50
+ :survey_choices => "L_SURVEYCHOICEn"
51
+ },
52
+ :ship_to => {
53
+ :ship_to_name => 'SHIPTONAME',
54
+ :ship_to_street => 'SHIPTOSTREET',
55
+ :ship_to_street_2 => 'SHIPTOSTREET2',
56
+ :ship_to_city => 'SHIPTOCITY',
57
+ :ship_to_state => 'SHIPTOSTATE',
58
+ :ship_to_zip => 'SHIPTOZIP',
59
+ :ship_to_country => 'SHIPTOCOUNTRYCODE',
60
+ :ship_to_phone_num => 'SHIPTOPHONENUM',
61
+ :ship_to_secondary_name => 'SHIPTOSECONDARYNAME',
62
+ :ship_to_secondary_address_line_1 => 'SHIPTOSECONDARYADDRESSLINE1',
63
+ :ship_to_secondary_address_line_2 => 'SHIPTOSECONDARYADDRESSLINE2',
64
+ :ship_to_secondary_city => 'SHIPTOSECONDARYCITY',
65
+ :ship_to_secondary_state => 'SHIPTOSECONDARYSTATE',
66
+ :ship_to_secondary_zip => 'SHIPTOSECONDARYZIP',
67
+ :ship_to_secondary_country => 'SHIPTOSECONDARYCOUNTRYCODE',
68
+ :ship_to_secondary_phone_no => 'SHIPTOSECONDARYPHONENUM',
69
+ :address_status => "ADDRESSSTATUS",
70
+ :address_normalization_statu => "ADDRESSNORMALIZATIONSTATUS"
71
+ },
72
+ :recurring => {
73
+ :subscriber_name => "SUBSCRIBERNAME",
74
+ :start_at => "PROFILESTARTDATE",
75
+ :description => "DESC",
76
+ :max_failed_payments => "MAXFAILEDPAYMENTS",
77
+ :auto_bill_outstanding => "AUTOBILLOUTAMT",
78
+ :reference => "PROFILEREFERENCE",
79
+ :amount => "AMT",
80
+ :currency => "CURRENCYCODE",
81
+ :period => "BILLINGPERIOD",
82
+ :frequency => "BILLINGFREQUENCY",
83
+ :additional_billing_cycles => "ADDITIONALBILLINGCYCLES",
84
+ :total_cycles => "TOTALBILLINGCYCLES",
85
+ :trial_period => "TRIALBILLINGPERIOD",
86
+ :trial_frequency => "TRIALBILLINGFREQUENCY",
87
+ :trial_total_cycles => "TRIALTOTALBILLINGCYCLES",
88
+ :trial_amount => "TRIALAMT",
89
+ :initial_amount => "INITAMT",
90
+ :outstanding_amount => "OUTSTANDINGAMT",
91
+ :failed_initial_action => "FAILEDINITAMTACTION",
92
+ :profile_id => "PROFILEID",
93
+ :profile_status => "PROFILESTATUS",
94
+ :token => "TOKEN",
95
+ :transaction_id => "TRANSACTIONID",
96
+ :action => "ACTION",
97
+ :note => "NOTE",
98
+ :status => "STATUS",
99
+ :aggregate_amount => "AGGREGATEAMOUNT",
100
+ :aggregate_optional_amount => "AGGREGATEOPTIONALAMOUNT",
101
+ :final_payment_due_date => "FINALPAYMENTDUEDATE",
102
+ :next_billing_date => "NEXTBILLINGDATE",
103
+ :cycles_completed => "NUMCYCLESCOMPLETED",
104
+ :cycles_remaining => "NUMCYCLESREMAINING",
105
+ :outstanding_balance => "OUTSTANDINGBALANCE",
106
+ :failed_payment_count => "FAILEDPAYMENTCOUNT",
107
+ :last_payment_date => "LASTPAYMENTDATE",
108
+ :last_payment_amount => "LASTPAYMENTAMT"
109
+ },
110
+ :amount => {
111
+ :amount => "AMT",
112
+ :currency => "CURRENCYCODE",
113
+ :item_amount => "ITEMAMT",
114
+ :shipping_amount => "SHIPPINGAMT",
115
+ :shipping_discount_amount => "SHIPDISCAMT",
116
+ :insurance_amount => "INSURANCEAMT",
117
+ :handling_amount => "HANDLINGAMT",
118
+ :fee_amount => "FEEAMT",
119
+ :settle_amount => "SETTLEAMT",
120
+ :tax_amount => "TAXAMT",
121
+ :net_amount => "NETAMT",
122
+ :regular_amount => "REGULARAMT",
123
+ :regular_shipping_amount => "REGULARSHIPINGAMT",
124
+ :regular_tax_amount => "REGULARTAXAMT",
125
+ :regular_currency => "REGULARCURRENCYCODE"
126
+ },
127
+ :payment => {
128
+ :timestamp => "TIMESTAMP",
129
+ :time_zone => "TIMEZONE",
130
+ :shipping_calculation_mode => "SHIPPINGCALCULATIONMODE",
131
+ :insurance_option_selected => "INSURANCEOPTIONSELECTED",
132
+ :transaction_id => "TRANSACTIONID",
133
+ :parent_transaction_id => "PARENTTRANSACTIONID",
134
+ :transaction_type => "TRANSACTIONTYPE",
135
+ :receipt_id => "RECEIPTID",
136
+ :payment_type => "PAYMENTTYPE",
137
+ :profile_id => "PROFILEID",
138
+ :order_time => "ORDERTIME",
139
+ :description => "DESC",
140
+ :custom => "CUSTOM",
141
+ :button_source => "BUTTONSOURCE",
142
+ :notify_url => "NOTIFYURL",
143
+ :recurring => "RECURRING",
144
+ :insurance_offered => "INSURANCEOPTIONOFFERED",
145
+ :allowed_payment_method => "ALLOWEDPAYMENTMETHOD",
146
+ :payment_action => "PAYMENTACTION",
147
+ :payment_request_id => "PAYMENTREQUESTID",
148
+ :exchange_rate => "EXCHANGERATE",
149
+ :status => "PAYMENTSTATUS",
150
+ :reason => "PAYMENTREASON",
151
+ :pending_reason => "PENDINGREASON",
152
+ :reason_code => "REASONCODE",
153
+ :protection_eligibility => "PROTECTIONELIGIBILITY",
154
+ :protection_eligibility_type => "PROTECTIONELIGIBILITYTYPE",
155
+ :ip_address => "IPADDRESS",
156
+ :confirm_shipping => "REQCONFIRMSHIPPING", # 0, 1
157
+ :return_fmf_details => "RETURNFMFDETAILS", # 0, 1
158
+ :soft_descriptor => "SOFTDESCRIPTOR",
159
+ :msg_sub_id => "MSGSUBID",
160
+ :store_id => "STOREID",
161
+ :terminal_id => "TERMINALID",
162
+ :invoice_num => "INVNUM",
163
+ :note_text => "NOTETEXT",
164
+ :note => "NOTE",
165
+ :sales_tax => "SALESTAX",
166
+ :name => "NAME",
167
+ :action => "ACTION",
168
+ :seller_account_id => "SELLERPAYPALACCOUNTID",
169
+ :authorization_id => "AUTHORIZATIONID"
170
+ },
171
+ :seller => {
172
+ :seller_id => "SELLERID",
173
+ :seller_username => "SELLERUSERNAME",
174
+ :seller_registration_date => "SELLERREGISTRATIONDATE"
175
+ },
176
+ :payment_item => {
177
+ :ebay_number => "EBAYITEMNUMBER",
178
+ :ebay_auction_txn_id => "EBAYITEMAUCTIONTXNID",
179
+ :ebay_order_id => "EBAYITEMORDERID",
180
+ :ebay_cart_id => "EBAYCARTID",
181
+ :item_url => "ITEMURL",
182
+ :item_category => "ITEMCATEGORY",
183
+ :name => "NAME",
184
+ :description => "DESC",
185
+ :number => "NUMBER",
186
+ :quantity => "QTY",
187
+ :coupon_id => "COUPONID",
188
+ :coupon_amount => "COUPONAMOUNT",
189
+ :coupon_amount_currency => "COUPONAMOUNTCURRENCY",
190
+ :card_discount => "LOYALTYCARDDISCOUNTAMOUNT",
191
+ :card_discount_currency => "LOYALTYCARDISCOUNTCURRENCY",
192
+ :amount => "AMT",
193
+ :options_name => "OPTIONSNAME",
194
+ :options_value => "OPTIONSVALUE",
195
+ :weight_value => "ITEMWEIGHTVALUE",
196
+ :weight_unit => "ITEMWEIGHTUNIT",
197
+ :length_value => "ITEMLENGTHVALUE",
198
+ :length_unit => "ITEMLENGTHUNIT",
199
+ :width_value => "ITEMWIDTHVALUE",
200
+ :width_unit => "ITEMWIDTHUNIT",
201
+ :height_value => "ITEMHEIGHTVALUE",
202
+ :height_unit => "ITEMHEIGHTUNIT"
203
+ },
204
+ :payment_info => {
205
+ :short_message => "SHORTMESSAGE",
206
+ :long_message => "LONGMESSAGE",
207
+ :error_code => "ERRORCODE",
208
+ :severity_code => "SEVERITYCODE",
209
+ :ack => "ACK"
210
+ },
211
+ :funding_source => {
212
+ :allow_push_funding => "ALLOWPUSHFUNDING" # 0, 1
213
+ },
214
+ :buyer => {
215
+ :buyer_id => "BUYERID",
216
+ :buyer_username => "BUYERUSERNAME",
217
+ :buyer_registration_date => "BUYERREGISTRATIONDATE"
218
+ },
219
+ :billing => {
220
+ :type => "BILLINGTYPE",
221
+ :description => "BILLINGAGREEMENTDESCRIPTION",
222
+ :custom => "BILLINGAGREEMENTCUSTOM",
223
+ :payment_type => "PAYMENTTYPE"
224
+ },
225
+ :payer => {
226
+ :buyer_marketing_email => "BUYERMARKETINGEMAIL",
227
+ :email => "EMAIL",
228
+ :payer_id => "PAYERID",
229
+ :payer_status => "PAYERSTATUS",
230
+ :payer_country => "COUNTRYCODE",
231
+ :payer_business => "PAYERBUSINESS",
232
+ :business => "BUSINESS",
233
+ :salutation => "SALUTATION",
234
+ :first_name => "FIRSTNAME",
235
+ :middle_name => "MIDDLENAME",
236
+ :last_name => "LASTNAME",
237
+ :suffix => "SUFFIX"
238
+ },
239
+ :receiver => {
240
+ :receiver_business => "RECEIVERBUSINESS",
241
+ :receiver_email => "RECEIVEREMAIL",
242
+ :receiver_id => "RECEIVERID"
243
+ },
244
+ :auction => {
245
+ :buyer_id => "BUYERID",
246
+ :closing_date => "CLOSINGDATE",
247
+ :multi_item => "MULTIITEM"
248
+ },
249
+ :subscription => {
250
+ :subscription_amount => "AMOUNT",
251
+ :period => "PERIOD"
252
+ },
253
+ :tax => {
254
+ :tax_id_type => "TAXIDTYPE",
255
+ :tax_id => "TAXID"
256
+ },
257
+ :shipping_option => {
258
+ :insurance_selected => "INSURANCEOPTIONSELECTED",
259
+ :is_default => "SHIPPINGOPTIONISDEFAULT",
260
+ :name => "SHIPPINGOPTIONNAME",
261
+ :label => "SHIPPINGOPTIONLABEL",
262
+ :amount => "SHIPPINGOPTIONAMOUNT",
263
+ :tax_amount => "TAXAMT",
264
+ :insurance_amount => "INSURANCEAMOUNT"
265
+ },
266
+ :credit_card => {
267
+ :credit_card_type => "CREDITCARDTYPE",
268
+ :account => "ACCT",
269
+ :expiry_date => "EXPDATE",
270
+ :cvv2 => "CVV2",
271
+ :start_date => "STARTDATE",
272
+ :issue_number => "ISSUENUMBER"
273
+ },
274
+ :address => {
275
+ :address_owner => "ADDRESSOWNER",
276
+ :address_status => "ADDRESSSTATUS",
277
+ :street => "STREET",
278
+ :street_2 => "STREET2",
279
+ :city => "CITY",
280
+ :state => "STATE",
281
+ :zip => "ZIP",
282
+ :country => "COUNTRYCODE",
283
+ :phone_num => "PHONENUM",
284
+ :confirmation => "CONFIRMATIONCODE",
285
+ :street_match => "STREETMATCH",
286
+ :zip_match => "ZIPMATCH"
287
+ },
288
+ :search => {
289
+ :start_date => "STARTDATE",
290
+ :end_date => "ENDDATE",
291
+ :receiver => "RECEIVER",
292
+ :auction_item_num => "AUCTIONITEMNUMBER",
293
+ :transaction_class => "TRANSACTIONCLASS"
294
+ },
295
+ :refund => {
296
+ :refund_type => "REFUNDTYPE",
297
+ :retry_until => "RETRYUNTIL",
298
+ :refund_source => "REFUNDSOURCE",
299
+ :store_details => "MERCHANTSTOREDETAILS",
300
+ :invoice_id => "INVOICEID",
301
+ :advice => "REFUNDADVICE",
302
+ :refund_item_details => "REFUNDITEMDETAILS",
303
+ :refund_transaction_id => "REFUNDTRANSACTIONID",
304
+ :fee_refund_amount => "FEEREFUNDAMT",
305
+ :gross_refund_amount => "GROSSREFUNDAMT",
306
+ :net_refund_amount => "NETREFUNDAMT",
307
+ :total_refunded_amount => "TOTALREFUNDEDAMOUNT",
308
+ :refund_info => "REFUNDINFO",
309
+ :refund_status => "REFUNDSTATUS",
310
+ :pending_reason => "PENDINGREASON"
311
+ },
312
+ :account => {
313
+ :all_currencies => "RETURNALLCURRENCIES",
314
+ :pal => "PAL",
315
+ :locale => "LOCALE"
316
+ },
317
+ :response => {
318
+ :token => "TOKEN",
319
+ :ack => "ACK",
320
+ :version => "VERSION",
321
+ :build => "BUILD",
322
+ :correlaction_id => "CORRELATIONID",
323
+ :requested_at => "TIMESTAMP"
324
+ },
325
+ :reference => {
326
+ :avs_code => "AVSCODE",
327
+ :cvv2_match => "CVV2MATCH",
328
+ :billing_agreement_id => "BILLINGAGREEMENTID",
329
+ :payment_advice_code => "PAYMENTADVICECODE"
330
+ },
331
+ :fmf => {
332
+ :pending_id => "FMFPENDINGID",
333
+ :pending_name => "FMFPENDINGNAME",
334
+ :report_id => "FMFREPORTID",
335
+ :report_name => "FMFREPORTNAME",
336
+ :deny_id => "FMFDENYID",
337
+ :deny_name => "FMFDENYNAME"
338
+ },
339
+ :callback => {
340
+ :token => "TOKEN",
341
+ :locale => "LOCALECODE",
342
+ :currency => "CURRENCYCODE",
343
+ :offer_insurance_option => "OFFERINSURANCEOPTION",
344
+ :no_shipping => "NO_SHIPPING_OPTION_DETAILS"
345
+ }
346
+ }
347
+
348
+ ASSOCIATIONS = {
349
+ :shipping_options => ATTRIBUTES[:shipping_option],
350
+ :billings => ATTRIBUTES[:billing],
351
+ :payment_items => ATTRIBUTES[:payment_item].
352
+ merge(ATTRIBUTES[:amount]),
353
+ :payments => ATTRIBUTES[:payment].
354
+ merge(ATTRIBUTES[:amount]).
355
+ merge(ATTRIBUTES[:ship_to]).
356
+ merge(ATTRIBUTES[:seller]),
357
+ :fmfs => ATTRIBUTES[:fmf]
358
+ }
359
+
360
+ def self.included(base)
361
+ base.extend(ClassMethods)
362
+ base.inheritable_attributes :field_groups, :associations
363
+ base.instance_variable_set("@field_groups", [])
364
+ base.instance_variable_set("@associations", [])
365
+ end
366
+
367
+ module ClassMethods
368
+ def field_groups
369
+ @field_groups ||= []
370
+ end
371
+
372
+ def associations
373
+ @associations ||= []
374
+ end
375
+
376
+ def field_map
377
+ @field_map ||= field_groups.inject({}) do |memo, group|
378
+ memo.merge(ATTRIBUTES[group])
379
+ end.merge(ASSOCIATIONS.select{ |k,v| associations.include?(k) })
380
+ end
381
+
382
+ def inverted_field_map
383
+ @inverted_field_map ||= field_map.invert
384
+ end
385
+
386
+ def has_fields(*args)
387
+ @field_groups += (args & ATTRIBUTES.keys)
388
+ @field_groups.each do |group|
389
+ ATTRIBUTES[group].each_key do |field|
390
+ attr_accessor field
391
+ end
392
+ end
393
+ end
394
+
395
+ def has_many(*args)
396
+ @associations += (args & ASSOCIATIONS.keys)
397
+ @associations.each do |many|
398
+ attr_accessor many
399
+ class_eval %(
400
+ def #{many}; @#{many} ||= [] end
401
+ )
402
+ end
403
+ end
404
+
405
+ def inheritable_attributes(*args)
406
+ @inheritable_attributes ||= [:inheritable_attributes]
407
+ @inheritable_attributes += args
408
+ args.each do |arg|
409
+ class_eval %(
410
+ class << self; attr_accessor :#{arg} end
411
+ )
412
+ end
413
+ @inheritable_attributes
414
+ end
415
+
416
+ def inherited(subclass)
417
+ @inheritable_attributes.each do |inheritable_attribute|
418
+ instance_var = "@#{inheritable_attribute}"
419
+ subclass.instance_variable_set(instance_var, instance_variable_get(instance_var))
420
+ end
421
+ end
422
+ end
423
+
424
+ def group_collect(*args)
425
+ collect(*group_fields(*args))
426
+ end
427
+
428
+ def group_fields(*args)
429
+ Array(args).map { |group| ATTRIBUTES[group] ? ATTRIBUTES[group].keys : group }.flatten
430
+ end
431
+
432
+ def field_map
433
+ self.class.field_map
434
+ end
435
+
436
+ def inverted_field_map
437
+ self.class.inverted_field_map
438
+ end
439
+
440
+ def has_fields?(group)
441
+ self.class.field_groups.include?(group)
442
+ end
443
+
444
+ def has_many?(association)
445
+ self.class.associations.include?(association)
446
+ end
447
+ end
448
+ end
449
+ end
@@ -0,0 +1,7 @@
1
+ module PayPal
2
+ module ExpressCheckout
3
+ class Fmf < PayPal::ExpressCheckout::Base
4
+ has_fields :fmf
5
+ end
6
+ end
7
+ end