Skip to content

Commit

Permalink
ci(postman): Rotate Paypal test cards to address collection failures (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
likhinbopanna authored Nov 5, 2023
1 parent cdca284 commit fd6280a
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "13",
"card_exp_year": "2023",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4005519200000004",
"card_number": "4012000033330026",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
Expand Down
27 changes: 27 additions & 0 deletions postman/collection-dir/paypal/event.prerequest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const path = pm.request.url.toString();
const isPostRequest = pm.request.method.toString() === "POST";
const isPaymentCreation = path.match(/\/payments$/) && isPostRequest;

if (isPaymentCreation) {
try {
const request = JSON.parse(pm.request.body.toJSON().raw);

// Attach routing
const routing = { type: "single", data: "paypal" };
request["routing"] = routing;

let updatedRequest = {
mode: "raw",
raw: JSON.stringify(request),
options: {
raw: {
language: "json",
},
},
};
pm.request.body.update(updatedRequest);
} catch (error) {
console.error("Failed to inject routing in the request");
console.error(error);
}
}
28 changes: 14 additions & 14 deletions postman/collection-json/paypal.postman_collection.json

Large diffs are not rendered by default.

0 comments on commit fd6280a

Please sign in to comment.