diff --git a/lib/tasks/payment.rake b/lib/tasks/payment.rake new file mode 100644 index 00000000..2bb4d81e --- /dev/null +++ b/lib/tasks/payment.rake @@ -0,0 +1,22 @@ +namespace :payment do + task :create => :environment do + payment_method_settings = PaymentMethodSetting.where(payment_method: 'PAYMAL') + payment_method_settings.each do |payment| + MembershipAction.create( + { membership_type: "create_payment", + is_active: 1, + gateway_url: "/api/create_payment", + merchant_account_id: payment.merchant_account_id, + auth_token: payment.auth_token, + shop_code: payment.shop_code + } + ) + end + + payment_method_settings.update_all({ + gateway_url: nil, + merchant_account_id: nil, + auth_token: nil }) + # payment_method_settings.delete_all + end +end