Class: UnivapayClientSdk::SubscriptionsApi
- Defined in:
- lib/univapay_client_sdk/apis/subscriptions_api.rb
Overview
SubscriptionsApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#cancel_subscription(store_id, id) ⇒ ApiResponse
Cancels an existing subscription.
-
#create_subscription(idempotency_key: nil, body: nil) ⇒ ApiResponse
Creates a new subscription.
-
#get_subscription(store_id, id, polling: nil) ⇒ ApiResponse
Retrieves the details of an existing subscription.
-
#get_subscription_latest_charge(store_id, subscription_id) ⇒ ApiResponse
Retrieves the most recent charge created for a specific subscription.
-
#get_subscription_payment(store_id, subscription_id, payment_id) ⇒ ApiResponse
Retrieves the details of an individual payment associated with a specific subscription.
-
#list_all_subscriptions(limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Lists all subscriptions across all stores.
-
#list_charges_for_subscription_payment(store_id, subscription_id, payment_id, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Retrieves a paginated list of all charge attempts made for a specific scheduled payment of a subscription.
-
#list_store_subscriptions(store_id, search: nil, status: nil, mode: nil, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Lists all subscriptions for a specific store.
-
#list_subscription_charges(merchant_id, store_id, subscription_id, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Retrieves a paginated list of charges linked to a subscription.
-
#list_subscription_payments(store_id, subscription_id, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Retrieves a list of all historical and scheduled payments for a specific subscription.
-
#suspend_subscription(store_id, subscription_id, idempotency_key: nil, body: nil) ⇒ ApiResponse
Suspends a subscription that is currently
currentorunpaid. -
#unsuspend_subscription(store_id, subscription_id, idempotency_key: nil) ⇒ ApiResponse
Resumes a subscription that is currently
suspended, setting its status back tounpaidand rescheduling the next payment. -
#update_subscription(store_id, id, idempotency_key: nil, body: nil) ⇒ ApiResponse
Updates the configuration, payment method, or schedule of a specific subscription.
-
#update_subscription_payment(store_id, subscription_id, payment_id, body, idempotency_key: nil) ⇒ ApiResponse
Updates properties of a specific scheduled payment for a subscription.
-
#update_subscription_token(store_id, subscription_id, body, idempotency_key: nil) ⇒ ApiResponse
Replaces the payment method (transaction token) used for a subscription.
Methods inherited from BaseApi
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from UnivapayClientSdk::BaseApi
Instance Method Details
#cancel_subscription(store_id, id) ⇒ ApiResponse
Cancels an existing subscription. The subscription status will be
permanently changed to canceled and it cannot be resumed. Please
proceed with caution.
of the store.
resource.
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 335 def cancel_subscription(store_id, id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/stores/{storeId}/subscriptions/{id}', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', ApiErrorException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#create_subscription(idempotency_key: nil, body: nil) ⇒ ApiResponse
Creates a new subscription. idempotency key to prevent double charges and duplicate operations. We recommend a randomly generated UUID (v4). Subscription request
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 16 def create_subscription(idempotency_key: nil, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/subscriptions', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Subscription.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', APIException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', APIException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', APIException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#get_subscription(store_id, id, polling: nil) ⇒ ApiResponse
Retrieves the details of an existing subscription. Supports internal polling to wait for status changes. of the store. true, instructs the API to internally poll the subscription status until it changes from 'unverified' (the initial status) to another status.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 205 def get_subscription(store_id, id, polling: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/stores/{storeId}/subscriptions/{id}', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .query_param(new_parameter(polling, key: 'polling')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Subscription.method(:from_hash)) .is_api_response(true) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', APIException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#get_subscription_latest_charge(store_id, subscription_id) ⇒ ApiResponse
Retrieves the most recent charge created for a specific subscription. Returns 404 if no charges have been attempted yet. of the store. identifier of the subscription.
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 602 def get_subscription_latest_charge(store_id, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/stores/{storeId}/subscriptions/{subscriptionId}/charges/latest', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscriptionId') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Charge.method(:from_hash)) .is_api_response(true) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', APIException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#get_subscription_payment(store_id, subscription_id, payment_id) ⇒ ApiResponse
Retrieves the details of an individual payment associated with a specific subscription. of the store. identifier of the subscription. identifier of the scheduled payment of a subscription
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 463 def get_subscription_payment(store_id, subscription_id, payment_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/stores/{storeId}/subscriptions/{subscriptionId}/payments/{paymentId}', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscriptionId') .is_required(true) .should_encode(true)) .template_param(new_parameter(payment_id, key: 'paymentId') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SubscriptionPayment.method(:from_hash)) .is_api_response(true) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', APIException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#list_all_subscriptions(limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Lists all subscriptions across all stores. return in one page. resource after which pagination should continue. Pagination direction relative to the supplied cursor.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 73 def list_all_subscriptions(limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/subscriptions', Server::DEFAULT) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(cursor_direction, key: 'cursor_direction')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SubscriptionList.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', APIException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', APIException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', APIException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#list_charges_for_subscription_payment(store_id, subscription_id, payment_id, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Retrieves a paginated list of all charge attempts made for a specific scheduled payment of a subscription. Useful for inspecting retry history. of the store. identifier of the subscription. identifier of the scheduled payment of a subscription return in one page. resource after which pagination should continue. Pagination direction relative to the supplied cursor.
745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 745 def list_charges_for_subscription_payment(store_id, subscription_id, payment_id, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/stores/{storeId}/subscriptions/{subscriptionId}/payments/{paymentId}/charges', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscriptionId') .is_required(true) .should_encode(true)) .template_param(new_parameter(payment_id, key: 'paymentId') .is_required(true) .should_encode(true)) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(cursor_direction, key: 'cursor_direction')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ChargeList.method(:from_hash)) .is_api_response(true) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#list_store_subscriptions(store_id, search: nil, status: nil, mode: nil, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Lists all subscriptions for a specific store. of the store. subscriptions by current status. processing mode. return in one page. resource after which pagination should continue. Pagination direction relative to the supplied cursor.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 137 def list_store_subscriptions(store_id, search: nil, status: nil, mode: nil, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/stores/{storeId}/subscriptions', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .query_param(new_parameter(search, key: 'search')) .query_param(new_parameter(status, key: 'status')) .query_param(new_parameter(mode, key: 'mode')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(cursor_direction, key: 'cursor_direction')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SubscriptionList.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', APIException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', APIException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', APIException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#list_subscription_charges(merchant_id, store_id, subscription_id, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Retrieves a paginated list of charges linked to a subscription. Backend search uses the same charge search surface as normal charge listing and adds a subscription filter for the requested subscription. identifier of the merchant. of the store. identifier of the subscription. return in one page. resource after which pagination should continue. Pagination direction relative to the supplied cursor.
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 669 def list_subscription_charges(merchant_id, store_id, subscription_id, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/merchants/{merchantId}/stores/{storeId}/subscriptions/{subscriptionId}/charges', Server::DEFAULT) .template_param(new_parameter(merchant_id, key: 'merchantId') .is_required(true) .should_encode(true)) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscriptionId') .is_required(true) .should_encode(true)) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(cursor_direction, key: 'cursor_direction')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ChargeList.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', ApiErrorException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#list_subscription_payments(store_id, subscription_id, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) ⇒ ApiResponse
Retrieves a list of all historical and scheduled payments for a specific subscription. of the store. identifier of the subscription. return in one page. resource after which pagination should continue. Pagination direction relative to the supplied cursor.
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 397 def list_subscription_payments(store_id, subscription_id, limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/stores/{storeId}/subscriptions/{subscriptionId}/payments', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscriptionId') .is_required(true) .should_encode(true)) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(cursor_direction, key: 'cursor_direction')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SubscriptionPaymentList.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', ApiErrorException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#suspend_subscription(store_id, subscription_id, idempotency_key: nil, body: nil) ⇒ ApiResponse
Suspends a subscription that is currently current or unpaid. The
termination_mode controls when the suspension takes effect: immediate
(default) suspends right away, on_next_payment waits until the next
scheduled payment date before suspending.
of the store.
identifier of the subscription.
idempotency key to prevent double charges and duplicate operations. We
recommend a randomly generated UUID (v4).
payload for suspending a subscription.
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 820 def suspend_subscription(store_id, subscription_id, idempotency_key: nil, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/stores/{storeId}/subscriptions/{subscriptionId}/suspend', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscriptionId') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Subscription.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', ApiErrorException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#unsuspend_subscription(store_id, subscription_id, idempotency_key: nil) ⇒ ApiResponse
Resumes a subscription that is currently suspended, setting its status
back to unpaid and rescheduling the next payment. No request body is
required.
of the store.
identifier of the subscription.
idempotency key to prevent double charges and duplicate operations. We
recommend a randomly generated UUID (v4).
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 888 def unsuspend_subscription(store_id, subscription_id, idempotency_key: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/stores/{storeId}/subscriptions/{subscriptionId}/unsuspend', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscriptionId') .is_required(true) .should_encode(true)) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Subscription.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', ApiErrorException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#update_subscription(store_id, id, idempotency_key: nil, body: nil) ⇒ ApiResponse
Updates the configuration, payment method, or schedule of a specific subscription. of the store. resource. idempotency key to prevent double charges and duplicate operations. We recommend a randomly generated UUID (v4). update on the subscription.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 270 def update_subscription(store_id, id, idempotency_key: nil, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/stores/{storeId}/subscriptions/{id}', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Subscription.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', ApiErrorException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#update_subscription_payment(store_id, subscription_id, payment_id, body, idempotency_key: nil) ⇒ ApiResponse
Updates properties of a specific scheduled payment for a subscription. Can be used to change the due date when permitted, mark the payment as paid, schedule a termination status, or set a retry interval. of the store. identifier of the subscription. identifier of the scheduled payment of a subscription payload for updating a scheduled subscription payment. idempotency key to prevent double charges and duplicate operations. We recommend a randomly generated UUID (v4).
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 533 def update_subscription_payment(store_id, subscription_id, payment_id, body, idempotency_key: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/stores/{storeId}/subscriptions/{subscriptionId}/payments/{paymentId}', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscriptionId') .is_required(true) .should_encode(true)) .template_param(new_parameter(payment_id, key: 'paymentId') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SubscriptionPayment.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', ApiErrorException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |
#update_subscription_token(store_id, subscription_id, body, idempotency_key: nil) ⇒ ApiResponse
Replaces the payment method (transaction token) used for a subscription. Useful when a card expires or a customer wants to switch payment methods. The new token must belong to the same store, be active, and match the subscription's processing mode (live/test). One-time tokens are not accepted; use a recurring or subscription token. of the store. identifier of the subscription. payload for replacing a subscription payment token. idempotency key to prevent double charges and duplicate operations. We recommend a randomly generated UUID (v4).
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 |
# File 'lib/univapay_client_sdk/apis/subscriptions_api.rb', line 956 def update_subscription_token(store_id, subscription_id, body, idempotency_key: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/stores/{storeId}/subscriptions/{subscriptionId}/token', Server::DEFAULT) .template_param(new_parameter(store_id, key: 'storeId') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscriptionId') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('JWT_TOKEN'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Subscription.method(:from_hash)) .is_api_response(true) .local_error_template('400', 'HTTP 400 Bad Request: {$response.body#/code}', ApiErrorException) .local_error_template('401', 'HTTP 401 Unauthorized: {$response.body#/code}', ApiErrorException) .local_error_template('403', 'HTTP 403 Forbidden: {$response.body#/code}', ApiErrorException) .local_error_template('404', 'HTTP 404 Not Found: {$response.body#/code}', ApiErrorException) .local_error_template('429', 'HTTP 429 Rate Limited: {$response.body#/code}', APIException) .local_error_template('409', 'HTTP 409 Conflict: {$response.body#/code}', APIException) .local_error_template('500', 'HTTP 500 Server Error: {$response.body#/code}', APIException) .local_error_template('503', 'HTTP 503 Unavailable: {$response.body#/code}', APIException) .local_error_template('504', 'HTTP 504 Timeout: {$response.body#/code}', APIException) .local_error_template('default', 'HTTP {$statusCode}: {$response.body#/code}', APIException)) .execute end |